Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
description: "Shared UI primitives keep Kobalte semantics, semantic tokens, a gallery page, and tests." paths: - "apps/web/src/components/ui/" globs: "apps/web/src/components/ui/" alwaysApply: false
UI primitives
Applies to apps/web/src/components/ui, including ports from shadcn-solid.
- Use the upstream structure and behavior as a starting point, then reshape exports to match the local slot-based, compound-component API.
- Replace upstream palette, surface, border, and status classes with the
existing semantic tokens; inputs normally use
bg-input,border-edge-muted,text-ink, andtext-ink-placeholder. - Preserve Kobalte semantics, state attributes, and polymorphic prop types. Keep accessibility relationships inside the primitive instead of recreating them at call sites.
- Add a co-located
*.docs.tsxgallery page and focused*.test.tsxcoverage for every ported component. - A primitive owns its look on desktop and touch. Expose role and size props
(
variant,size,fullWidth,iconOnly) and typed values, not class hooks into its parts (itemClass,labelClass);classplaces the root. - Before adding a control, check the roles in
design-system.md; extend the component for that role instead of adding a second one. - Keep
Inputa thin native control. UseInputGroupfor icons, clear actions, inline Buttons, and shared ButtonGroup framing instead of adding composition props toInput. - In
InputGroup, keep the input as the single control and place surrounding content inAddonslots. Usealignfor visual placement so accessible DOM order stays independent of layout.
Button and ButtonGroup
- Keep the shared
Buttonand@uiimport; migrate callers directly instead of adding parallel implementations or legacy-prop adapters. The role and variant policy lives in the design system rule. - Buttons perform actions; navigation uses anchors.
variant="link"changes appearance, not semantics. - Name icon-only actions with
aria-label. Tooltips are independent: use a string or{ content, placement, disabled, hotkey, shortcut }. Do not restorelabel, root-levelhotkey/shortcut,square,depth,glass, ornoTouchResize. - Use
xsthroughxlfor labeled actions andicon-xsthroughicon-xlfor square actions. Shared minimum heights are 24/28/32/40/48px; labeled controls can grow with their content. Preserve the 36px touch minimum and size rendered glyphs separately. Composer Send, microphone, and attachment controls useicon-md, with 20px desktop and 24px touch glyphs. - Keep ordinary children in the Button's flex row so trailing carets, truncation, and custom spacing work. Only loading actions need the reserved-content layer. Preserve native disabled behavior and activation guards for polymorphic controls.
- Pass only styling fields to Button style helpers; spreading props with
childrenevaluates Solid getters and can detach memoized content. - Compose groups explicitly with
ButtonGroup.Button; standalone Buttons do not inherit group styling. Segments inherit size and variant unless overridden, remain flat, and own their hover/pressed/disabled states. The frame owns its material once, without a whole-group hover treatment. Group labels usearia-label;CopyButtonjoins withas={ButtonGroup.Button}. - Keep
aria-expandedon disclosure controls without treating expanded content as a selected action. Button highlights an open popup only when the same trigger hasaria-haspopup; usearia-pressedfor genuine action toggles. - Keep Button's visible focus outline suppressed in ordinary color modes and retain its forced-colors indicator. Do not remove other controls' focus styling.
- Keep Tooltip's assembled and compound APIs on the same implementation and clean up closed or detached popups. Do not add document-wide mutation observers to track individual triggers.
- Keep materials in
src/index.css; JavaScript only derives accent text contrast and the corresponding state-mix direction. Reset runtime material assignments at theme boundaries so previews resolve their own palette. Do not persist derived Button tokens in authored theme data.
Selection controls
- Use
Checkboxfor independent values,RadioGroupfor one choice among values, andToggleSwitchfor a setting that takes effect immediately. Retain their native inputs, accessible labels, controlled/uncontrolled state, and keyboard behavior. - Keep unchecked checkbox and radio faces transparent. Checked and indeterminate
controls use the accent fill. Checkbox marks and radio indicators share the
accent Button's
button-accent-inktoken. - Set checkbox/radio size on the root:
smis 14px,md(default) is 16px, andlgis 20px.ToggleSwitchtracks usexs28×14px,sm(default) 32×16px, andmd40×20px. Do not resize internal SVGs or override selection colors from callers or enclosing pages; checked controls use the theme accent. - Switch thumbs stay fixed white in both states and every theme, with a secondary border.
Only the track changes to the theme accent when checked; do not apply accent-contrast to the thumb.
Use the shared
ToggleSwitchfor code-preview controls instead of separately styled Kobalte parts. - Render
Checkbox.ControlorRadioGroup.ItemControlonce per value; each includes its native input and default indicator. Do not add a second Input slot. - Use
InlineCheckboxonly as an aria-hidden decoration for an interactive row or selection control that owns selection, focus, and input semantics. Entity list selection uses it insideMultiSelectCheckboxto retain shift-click and full-cell hit targets. Single-select menus retain their trailingSingleSelectCheck, not a checkbox. - Keep checkbox draw/retract and switch press motion CSS-only and respect reduced motion. Preserve selection-control focus indicators independently of Button styling.