npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@inlayphp/actions-react

v0.3.14

Published

Accessible React action controls for Inlay.

Readme

@inlayphp/actions-react

npm License

Accessible React action controls for Inlay

Accessible React 19 controls for action resources produced by inlayphp/actions, powered by the framework-neutral @inlayphp/actions runtime.

Installation

pnpm add @inlayphp/actions-react @inlayphp/actions react react-dom

Quick start

import { ActionButton, ActionDialog, useActionRuntime } from '@inlayphp/actions-react'
import { ActionValidationError, type ActionResource } from '@inlayphp/actions'

export function ArchiveButton({ action, customerId }: {
  action: ActionResource
  customerId: number
}) {
  const runtime = useActionRuntime(async ({ action, input, url }) => {
    const response = await fetch(url!, {
      method: action.method.toUpperCase(),
      headers: { 'Content-Type': 'application/json', Accept: 'application/json' },
      body: JSON.stringify(input.data),
    })
    const payload = await response.json()
    if (response.status === 422) throw new ActionValidationError(payload.errors)
    if (!response.ok) throw new Error(payload.message)
    return payload
  })

  return <>
    <ActionButton action={action} input={{ parameters: { id: customerId } }} runtime={runtime} />
    <ActionDialog runtime={runtime}>
      <textarea
        aria-label="Reason"
        onChange={(event) => runtime.setData({ reason: event.target.value })}
      />
    </ActionDialog>
  </>
}

Render one ActionDialog for each runtime boundary. Multiple buttons may share the same runtime and dialog.

Components and hook

useActionRuntime(executor) exposes reactive state, trigger, confirm, setData, cancel, close, and restoreFocus. It keeps the executor current without recreating the state machine and restores focus to the triggering element after closing.

ActionButton accepts normal button attributes plus action, runtime, optional execution input, and optional children. It disables itself during execution and uses the action label when children are omitted.

It also draws the PHP trigger contract directly: button, link, icon-button, or badge treatment; size, outline, tooltip, icon position, badge content/color, disabled state, and keyboard bindings. Icon buttons preserve the label as their accessible name and include a mobile touch target without making the visible control oversized.

ActionDialog renders only during confirmation, execution, validation error, or failure. It provides dialog labelling, focus entry/containment/return, configurable Escape and backdrop dismissal, processing status, and accessible validation/failure alerts. Its children form the optional modal body; call runtime.setData() to merge values into the eventual execution payload.

Styling and customization

Controls use Tailwind utilities and stable Inlay CSS variables including --inlay-accent, --inlay-danger, --inlay-success, --inlay-warning, --inlay-foreground, --inlay-muted, --inlay-surface, --inlay-border, --inlay-hover, and --inlay-radius.

Both controls accept className; ActionButton also accepts all standard button attributes. Unknown action colors fall back to the gray palette. For a fully custom presentation, use useActionRuntime() directly and render from runtime.state.phase.

With Tailwind CSS 4, include the package source when it is outside automatic detection:

@source '../../node_modules/@inlayphp/*/src/**/*.{ts,tsx,vue}';

Development

pnpm typecheck
pnpm test -- --run
pnpm build

Related packages: @inlayphp/actions (runtime), @inlayphp/actions-vue, and inlayphp/actions (PHP resources).