trendmicro-frontend/tonic-ui/tonic-ui-slots
Claude Code and agent skill by trendmicro-frontend/tonic-ui
- community
Checking that the SKILL.md file is still in the repository.
Author and migrate the slots / slotProps API (the useSlot hook) in this design system's React components — the architecture where slots.x replaces an internal part and slotProps.x merges props into it. Use this whenever you are wiring an internal component part so consumers can swap it via slots.x or configure it via slotProps.x, authoring a slot's props / handler chaining / element resolution, or migrating a component from the deprecated *Component / *Props pairs (TransitionComponent/Transitio…
Install
npx vskill@latest install trendmicro-frontend/tonic-ui/tonic-ui-slotsSKILL.md
Tonic UI Slots
The slots / slotProps API gives consumers granular control over a component's internal parts — `slots` replaces the element rendered for a part, `slotProps` merges extra props into it — without forking the component. Internally, each slot is wired with the useSlot hook.
This skill covers both authoring slots on a component and migrating the legacy *Component / *Props prop pairs (e.g. TransitionComponent / TransitionProps, PopperComponent / PopperProps) to the slots API.
When to Use
- Adding slot support to a new or existing component (wire an internal part with
useSlotso it can be replaced viaslots.xor configured viaslotProps.x) - Authoring the internal
props, handler chaining, and slot resolution for a slot - Migrating a component from the deprecated
*Component/*Propspairs toslots/slotProps.
Workflow and References
Paths starting with packages/ are relative to the repository root; component paths such as modal/ModalContent.js are relative to packages/react/src/. The reference links below are relative to this skill directory, not the CWD.
- Read the component and its existing handler chains before changing it.
- Read API and handler authoring before wiring or reviewing
a slot. It defines prop merging, composed refs/styles, imports, and warnings.
- For a legacy-prop migration, also read migration examples
before editing. Preserve context fallbacks, render-prop children, parent threading, deprecation warnings, and explicitly merged arrays.
- Apply the invariants below, then exercise the changed consumer behavior.
Current Integration Status
Full __sx integration is not complete in this Tonic UI checkout, but the useSlot contract below is implemented here: packages/react/src/slot/useSlot.js composes both ref (via useMergeRefs) and __sx (via composeSx), and the composition is covered by packages/react/src/slot/__tests__/useSlot.test.js. The remaining gap is repo-wide component migration, not the hook. Inspect the affected implementation before relying on it, and do not silently expand a slot task into a styling integration change.
API Invariants
useSlotreturns[ElementType, mergedProps]. Import it as a named export:
internally import { useSlot } from '../slot'; externally from @tonic-ui/react.
- Ordinary
slotPropsoverride internalprops; refs are composed. - Slot style composition: put base styling in
props.__sx, and letuseSlot
compose it below the slot's incoming __sx, emitting __sx only when supplied. __sx is emitted only when at least one side supplies it.
- Legacy and new props merge as
{ ...XProps, ...slotProps.x }; element types
resolve as slots.x ?? XComponent ?? Default. Do not replace legacy props with ??.
- A new slot with no legacy props accepts
slotProps.xdirectly. Undefined
slot props are valid; only an undefined resolved element causes a dev warning.
Reference Implementation and Required Behavior
ModalContent (packages/react/src/modal/ModalContent.js) is the canonical example.
Key rules carried from the migration:
slots.transitionoverridesTransitionComponent— element resolves by precedence (slots.transition ?? TransitionComponent ?? Default)slotProps.transitionmerges overTransitionProps— props are merged, new wins ({ ...TransitionProps, ...slotProps.transition })inis always set after{...transitionSlotProps}— component owns open/close state- The component's forwarded
refgoes insideprops(props: { ref: combinedRef, ... }) - Static internal props (ref, aria attrs, role, tabIndex, appear) go in
props - Computed context-derived props (e.g.
direction,easing,timeout) go inprops - DOM event handlers go after the spread using
callEventHandlers(transitionSlotProps.handler, internalFn) - Lifecycle callbacks (onExited, onEnter) go after the spread using
callAll(internalFn, transitionSlotProps.handler) - Array props that must merge (e.g. Popper
modifiers) go after the spread with explicit merge useSlotis now exported from the publishedreactpackage (@tonic-ui/react); within thereactpackage, import from../slot(internal path)
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/internal/tonic-ui-slots/SKILL.md
Popularity
- Repository stars
- 133
- Repository forks
- 39
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/trendmicro-frontend/tonic-ui/tonic-ui-slots)