Skill library

Agent skill UI design

Modal

Shape a web interface around a coherent visual direction.

  • UI design
  • UI components

Install the skill

Installation method

Run the command from your project root with Node.js and npm.

npx skills@latest add https://github.com/lobehub/lobehub/tree/canary/.agents/skills/modal --skill modal --agent claude-code --yes

Check this file in your project.claude/skills/modal/SKILL.md

Other ways to install
  • Choose an assistant interactively

    npx skills@latest add https://github.com/lobehub/lobehub/tree/canary/.agents/skills/modal --skill modal

    Select your assistant and choose the project installation scope.

    Official instructions

The tested Skills CLI 1.10.0 requires Node.js 22.20 or later. Requires React and the LobeHub UI package already used by your project. The canary Skill documents @lobehub/ui/base-ui. Public @lobehub/ui 6.27.2 has no base-ui package export. The root-export example below was verified with 6.27.2 and React 19.2.

View operation manual

What this skill helps with

  • Shape a web interface around a coherent visual direction.

Good for

  • Visual direction
Task
Make a LobeHub feature dialog close and reopen reliably
Inputs
Requires React and the LobeHub UI package already used by your project. The canary Skill documents @lobehub/ui/base-ui. Public @lobehub/ui 6.27.2 has no base-ui package export. The root-export example below was verified with 6.27.2 and React 19.2.
Deliverable
A named dialog with a matching host, cleanup after both dismissal paths, and keyboard focus returned to its trigger.
Skill name
modal
Repository
lobehub/lobehub

Resolve the entry point first

An underspecified request

Fix every dialog by changing the import to base-ui.

A missing package export breaks the build. A host from a different modal stack leaves the dialog invisible.

A verifiable workflow

  1. Check the installed package exports and project root before making edits.
  2. Handle completion after either keyboard dismissal or the content action.
  3. Verify the dialog closes, returns focus and can reopen.

LobeHub Modal operation manual

A named dialog with a matching host, cleanup after both dismissal paths, and keyboard focus returned to its trigger.

Requires React and the LobeHub UI package already used by your project. The canary Skill documents @lobehub/ui/base-ui. Public @lobehub/ui 6.27.2 has no base-ui package export. The root-export example below was verified with 6.27.2 and React 19.2.

  1. Resolve the entry point and its host

    Check the installed package exports and project root before making edits.

    Prompt · Step 1
    Read the installed modal Skill and inspect [project workspace] and its locked @lobehub/ui dependency. Check the exports of the installed package and identify which ModalHost matches the available createModal entry point. Use the documented @lobehub/ui/base-ui path when that export exists. With public 6.27.2, use the root createModal, ModalHost, and useModalContext together. Confirm the existing provider and styles are present. For a standalone 6.27.2 reproduction, use MotionProvider with motion from motion/react and the exported global.css, theme.css, and style.css. Report what the project already provides before adding another host.
  2. Wire one named dialog and its cleanup

    Handle completion after either keyboard dismissal or the content action.

    Prompt · Step 2
    Using the entry point and installed version we confirmed, implement only [feature dialog and opener]. Use a descriptive title, pass body content with content, and close from the body through useModalContext where appropriate. Put feature cleanup in onOpenChangeComplete and guard it with !open. Preserve the existing save and validation behavior and mount the matching ModalHost once near the root if the host is missing.
  3. Test both close paths in the browser

    Verify the dialog closes, returns focus and can reopen.

    Prompt · Step 3
    In [local route], open the dialog with the keyboard and verify its accessible name. Close with Escape, confirm focus returns to the opener, then reopen and close with the content action. Verify onOpenChangeComplete(false) runs on both paths and the next opening has the expected state. Report the installed package version, import path and any browser failures.

Look up dialog callbacks

Verify behavior for each close path.

Why does cleanup work with Escape but fail after a body action?ModalHost
Command or reference
onOpenChange · onOpenChangeComplete
Examples
The imperative content close updates the stack directly. In the tested 6.27.2 entry point, Escape emitted onOpenChange(false) and onOpenChangeComplete(false). Closing from the body emitted only onOpenChangeComplete(false).

Troubleshooting and FAQ

Why does cleanup work with Escape but fail after a body action?

The imperative content close updates the stack directly. In the tested 6.27.2 entry point, Escape emitted onOpenChange(false) and onOpenChangeComplete(false). Closing from the body emitted only onOpenChangeComplete(false).