--- name: component-authoring description: > Use when creating or refactoring @techsio/ui-kit React components in libs/ui, including atoms, molecules, organisms, tv() variants, React 19 ref props, component token CSS, Storybook stories, package subpath exports, and Figma handoff reminders. metadata: type: "core" library: "@techsio/ui-kit" library_version: "0.3.2" requires: "tailwind-token-authoring storybook-authoring" sources: "https://github.com/TechsioCZ/new-engine/issues/295" contributor_sources: "libs/ui/AGENTS.md libs/ui/README.md libs/ui/src/atoms/button.tsx libs/ui/src/molecules/carousel.tsx libs/ui/src/organisms/header.tsx libs/ui/src/tokens/components/components.css libs/ui/stories/atoms/button.stories.tsx" resources: "../../references/component-contracts.md ../../references/consumer_app_usage_rules.md" audience: "contributor" --- > Portable scope: Source-authoring steps and monorepo commands require an explicit kit source checkout. In an installed consumer app, route to ../component-usage-ux/SKILL.md instead; do not run contributor commands or require repository artifacts. Resolve ../../references/ paths from this skill's folder, not the app working directory. # @techsio/ui-kit Component Authoring Use this for work inside `libs/ui`. For app-side usage, load `component-usage-ux` instead. ## Setup Minimum atom shape for new component code: ```tsx import type { ButtonHTMLAttributes, Ref } from "react" import type { VariantProps } from "tailwind-variants" import { useUIDefaults } from "../theme/ui-provider" import { tv } from "../utils" const actionVariants = tv({ base: "inline-flex items-center justify-center rounded-action text-action-fg", variants: { severity: { primary: "", danger: "", }, appearance: { solid: "", outline: "border-(length:--border-width-action) bg-transparent", }, size: { sm: "h-action-sm p-action-sm text-action-sm", md: "h-action-md p-action-md text-action-md", }, }, compoundVariants: [ { severity: "primary", appearance: "solid", className: "bg-action-bg-primary" }, { severity: "danger", appearance: "solid", className: "bg-action-bg-danger" }, ], defaultVariants: { severity: "primary", appearance: "solid", size: "md" }, }) type ActionProps = ButtonHTMLAttributes & VariantProps & { ref?: Ref } export function Action({ severity, appearance: appearanceProp, size: sizeProp, className, ref, ...props }: ActionProps) { // Prop → nearest UIProvider → the component's own default. const { size, appearance } = useUIDefaults( "Action", { size: sizeProp, appearance: appearanceProp }, actionVariants ) return (