Design system / Shadcn
CreativeXHub design system
Shadcn
Local ownership of shadcn-derived components, their runtime dependencies and the process for reviewing upstream changes.
Maintain the local component contract
CreativeXHub maintains shadcn-derived source in src/components/ui/. These components use Tailwind v4, semantic theme tokens and, where needed, Radix primitives from radix-ui or Embla for Carousel. The checked-in API is the supported contract, not the latest upstream default. Custom generic components must meet the same accessibility and integration standards.
Local source ownership and runtime dependencies
shadcn distributes source that the project maintains locally. A newer registry version does not automatically update checked-in components. Compare proposed changes with local APIs and adaptations. Components still use runtime dependencies, including Radix for keyboard, focus and disclosure behavior, and Embla for Carousel.
| Part | Its responsibility |
|---|---|
| Upstream source | A reviewed starting point, primitive-specific APIs and interaction behavior. |
| CreativeXHub foundations | The semantic colors, type, geometry and Tailwind mappings used by components. |
| Local generic component | The checked-in structure, props, variants and control behavior we support. |
| Consumer or product instance | Field arrangement, help, product copy, values and behavior bindings. |
Current project configuration
| Setting | Current value |
|---|---|
| Style / base color | new-york / neutral |
| React Server Components / TypeScript | rsc: true / tsx: true |
| CSS variables | true |
| Global CSS entry | src/app/globals.css |
| UI / utilities aliases | @/components/ui / @/lib/utils |
These selected settings come from components.json. Radix use is observed in the checked-in controls, not inferred from a missing configuration field. The current cn() helper combines clsx and tailwind-merge to compose and reconcile utility classes.
Repository path: components.json
Repository path: src/lib/utils.ts
Local adaptation can live in the theme
| Utility | What makes it CreativeXHub-specific |
|---|---|
| bg-primary / text-primary-foreground | Resolve semantic roles. A tenant palette can remap those roles without creating a new Button. |
| text-md / text-label | Use the fluid scale and the purpose-driven label role respectively. |
| p-4 / rounded-md | Use the 4px spacing multiplier and an explicit radius mapping. The 10px rem basis does not turn p-4 into 40px. |
Review proposed component additions
Check the local inventory and current shadcn registry first. Adopt an available component and its composition patterns rather than build a parallel interaction engine. Select source compatible with the project's primitive APIs, controlled-state contracts, slots, refs, keyboard behavior and client boundaries. An upstream component called Field is a candidate, not proof that Field is installed locally.
# Examples only: choose a reviewed CLI version and a missing component.
npx shadcn@<reviewed-version> view <component>
npx shadcn@<reviewed-version> add <component> --dry-run
# Only after reviewing the proposed files and dependencies:
npx shadcn@<reviewed-version> add <component>Record adoption evidence and local changes
Record the upstream baseline, deliberate local adaptations and affected consumers. If provenance is unknown, state that uncertainty. Component appearance does not establish its source version or change history.
Component: <name>
Upstream source: <URL / registry item>
Primitive implementation: <selected implementation>
Baseline version or commit: <known value, or unknown>
Retrieved: <date>
Local source: <path>
Supported contract: <props / variants / state API>
Local adaptation and rationale: <evidence>
Affected consumers and migration: <scope>A template for future adoption notes—not established provenance for existing files. Local inspection tells us the present contract, not the original upstream version or who made each change.
When reconciling an update, retain accessible names, focus behavior, label associations, state contracts and slot semantics. Review dependency changes and migrate affected consumers deliberately instead of regenerating blindly.
Upstream reference material
These external, live references complement our local contracts. They are not pinned snapshots or instructions to replace the project with today's defaults.
- Introduction: source ownership and composition (opens in a new tab)
- CLI: inspect proposed additions and updates (opens in a new tab)
- Theming: semantic CSS-variable roles (opens in a new tab)
- Radix Checkbox: primitive-specific state and API (opens in a new tab)
- Radix Field patterns: a composition candidate (opens in a new tab)
Carousel foundation
Carousel uses the standard shadcn composition and Embla engine. Compose CarouselContent and CarouselItem inside Carousel, then add CarouselPrevious and CarouselNext. Default slides take the full width; controls sit outside the slide edges and render only when their direction has a destination. A single slide or a fully fitting set has no paddles. ContentCarousel adds CarouselMedia and overlay controls: hover or focus within media reveals available edge paddles. Mobile and touch-only devices keep Embla swipe and dot navigation without paddles. Card mode retains its heading in CardHeader, not its controls. One active-item footer can place dots beside product actions. Both variants reuse existing engine state and empty-state behavior.
| Contract | Supported behavior |
|---|---|
| opts / plugins / orientation / setApi | Forward Embla configuration and plugins, select horizontal or vertical layout, and expose the engine API through shadcn's standard props. |
| CarouselContent / CarouselItem | Standard overflow-hidden viewport, flex track, full-width slides and spacing. Native element props and className remain supported. Optional viewportClassName sizes the outer viewport, for example min-h-0/flex-1 for the expanded presentation; className still belongs to the inner track. |
| CarouselPrevious / CarouselNext | Shared Button props with outline/icon defaults. Each paddle returns no markup when its direction is unavailable. Embla's existing canScrollPrev/canScrollNext state also hides both when all slides fit. |
| CarouselMedia / CarouselOverlayControls | Relative hover/focus overlays. A supplied slideIndex excludes inactive slide controls from tab/screen-reader navigation. Omit slideIndex to mount one stable pair on the positioned carousel owner, as expanded mode does outside its changing media/footer. CSS hides paddles below md and without fine-pointer hover; no hover/touch/resize listeners are added. |
| CarouselIndicators / useCarousel | The bounded Context exposes selectedIndex, snapCount and scrollTo. Dots use those engine values, aria-pressed and shared Button targets; fewer than two snaps renders no group. Swipe and reInit keep selection synchronized. |
| Local adaptations | Use the existing cn helper and Button without overwriting them. Colocate Embla lifecycle in useCarouselBehavior under ADR-0032, remove both event subscriptions on cleanup, and leave nested media/input arrow keys untouched. Navigation buttons use type=button. Paddle availability reads existing initialization/select/reInit state; CSS handles hover/focus visibility. No polling, animation-frame work, DOM size reads or resize/scroll observers are added. Paddles never change viewport width. |
| State and limits | Embla owns dragging, snapping, focus-driven selection and resizing. Context coordinates this carousel only. No custom native-scroll engine, wheel handler, autoplay, automatic video pause or engine motion override is added. Overlay fades respect reduced-motion preferences. |
Current component with fictional data. Example changes are not persisted.
Example content (4)
Contained carousel (3)
Standard shadcn responsive slide sizing: both slides fit from sm upward; narrow screens show one slide at a time. Embla updates paddle visibility when the layout changes.
Slide 1
Slide 2
Supplier is not a size tier
Shadcn can supply atoms, focused compound assemblies and larger starting points. A Dialog container completes one disclosure concern; the manager inside it may coordinate many concerns. Do not call every export an atom or classify by folder alone.
Current component with fictional data. Example changes are not persisted.
Current local UI inventory · 42 files
Derived from the current UI directory. Availability does not prove product adoption or complete taxonomy compliance. Tests are excluded.
Before adding or updating a component
- Check the local library and current shadcn registry first. Use the supplied component and composition patterns instead of writing a parallel interaction engine. Review existing consumer contracts before adopting upstream changes; theme shared components separately.
- Declare taxonomy, owner, instance boundary, server boundary and state level.
- Keep domain vocabulary, API paths, tenant assumptions and business rules out of components/ui.
- Use semantic utilities, cn(), explicit labels, correct element semantics and supported controlled-state contracts.
- Test keyboard behavior, feedback, focus return and affected consumers under ADR-0033.