lobehub avatar

Modal

This teaches Claude the LobeHub modal conventions, specifically pushing you toward the imperative base-ui API (createModal, confirmModal) instead of declarative open state patterns. It covers the required ModalHost mounting, the Content plus index.tsx file split, when to use the content prop versus children, and how to handle i18n inside createModal calls where hooks aren't available. The big gotcha is that base-ui modals render through a separate ModalHost from the legacy root package, so you need both mounted during migration or nothing shows up. Useful if you're working in a LobeHub codebase and need to know whether to reach for @lobehub/ui or @lobehub/ui/base-ui when opening dialogs.

skills.sh installs
1.3K
GitHub stars
79.8K
last updated
Jul 14, 2026

Install

$ npx -y skills add lobehub/lobe-chat --skill modal --agent claude-code

Installs into .claude/skills of the current project.

Files

Modal Imperative API Guide

Recommended: @lobehub/ui/base-ui

New code should use the base-ui modal stack (headless primitives, not antd Modal):

  • createModal, confirmModal, ModalHost from @lobehub/ui/base-ui
  • useModalContext from @lobehub/ui/base-ui inside modal content

Body slot: pass content (or children; runtime uses content ?? children).

Global ModalHost (required)

Base-ui createModal renders through a separate host from the root package. The app must mount ModalHost from @lobehub/ui/base-ui once near the root (e.g. next to other global hosts). Without it, createModal calls will not appear.

If the project only mounts ModalHost from @lobehub/ui, add a second lazy ModalHost from @lobehub/ui/base-ui until all imperative modals are migrated.

Why imperative?

ModeCharacteristicsRecommended
Declarativeopen state + <Modal />❌
ImperativeCall createModal(), no local state✅

File structure

Sponsors

Details

Repository
github.com/lobehub/lobe-chat
First seen
May 16, 2026

More from lobehub/lobe-chat

All 16

Recommended

1juliusbrussee avatarcavemanjuliusbrussee/cavemanUltra-compressed communication mode. Cuts output tokens 65% (measured) by speaking like caveman while keeping full technical accuracy. Supports intensity levels618.3Kskills.sh installs
2mattpocock avatargrill-memattpocock/skillsA relentless interview to sharpen a plan or design.1.5Mskills.sh installs
3shadcn avatarimproveshadcn/improveSurvey any codebase as a senior advisor and produce prioritized, self-contained implementation plans for OTHER models/agents to execute. Strictly read-only on s40Kskills.sh installs
4obra avatarsystematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes326.7Kskills.sh installs
5forrestchang avatarkarpathy-guidelinesforrestchang/andrej-karpathy-skillsBehavioral guidelines to reduce common LLM coding mistakes through explicit assumptions, simplicity, and verifiable success criteria.17.9Kskills.sh installs
6vercel-labs avatarfind-skillsvercel-labs/skillsHelps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express int4.3Mskills.sh installs