Basic Workflow
Relevant source filesPurpose and Scope
This document describes the typical development workflows and patterns used when building user interfaces with@ui8kit/core. It covers common scenarios developers encounter when composing components, applying styling through the variant system, and building standard UI patterns like cards, forms, and layouts.
For advanced scenarios where standard components are insufficient (e.g., creating custom form components), see Advanced Workflow. For general guidelines and performance recommendations, see Best Practices.
Sources: .devin/wiki.json181-188 src/components/README.md1-259
Component Selection Workflow
The first step in any development workflow is selecting the appropriate component for your use case. The library follows a three-layer hierarchy where each layer serves specific purposes.| Scenario | Component Choice | Reason |
|---|---|---|
| Generic container with styling | Box | Flexible primitive with full variant support |
| Semantic HTML element (section, article, nav) | Block | Renders semantic tags with component prop |
| Grid layout | Grid | CSS Grid with responsive presets |
| Flexbox layout | Flex or Stack | Flex for general, Stack for vertical/horizontal |
| Interactive button | Button | Pre-styled with variants and states |
| Content card | Card | Compound component with Header/Content/Footer |
| Dashboard template | DashLayout | Complete layout with sidebar and header |
Basic Styling Workflow
All components accept variant props instead of className strings. This workflow shows how to apply styling through the variant system.Step-by-Step: Styling a Component
Step 1: Apply spacing variantsnone, xs, sm, md, lg, xl, 2xl, auto
Step 2: Apply color variants
Variant Props Reference
| Category | Props | Values |
|---|---|---|
| Spacing | p, px, py, pt, pb, pl, pr | none, xs, sm, md, lg, xl, 2xl |
| Spacing | m, mx, my, mt, mb, ml, mr | none, xs, sm, md, lg, xl, 2xl, auto |
| Colors | bg, c, borderColor | Design system color tokens |
| Rounded | rounded | none, sm, md, lg, xl, 2xl, 3xl, full |
| Shadow | shadow | none, sm, md, lg, xl, 2xl |
| Layout | w, h, minH, maxW | auto, full, screen, fit, min, max |
| Position | position | static, relative, absolute, fixed, sticky |
Layout Pattern Workflows
Vertical Stacking with Stack
The most common layout pattern is vertical stacking of elements.
Stack props:
gap: Space between children (xs,sm,md,lg,xl,2xl)align: Cross-axis alignment (start,center,end,stretch)justify: Main-axis alignment (start,center,end,between,around)
Horizontal Layout with Group
For horizontal arrangements, use Group.
Grid Layout with Grid
For multi-column layouts, use Grid with responsive presets.
cols preset values:
"1-2-3": 1 column mobile, 2 tablet, 3 desktop"2": 2 columns at all breakpoints- Custom: Use standard Grid props
Responsive Container
UseContainer for centered, max-width layouts.
xs: 448pxsm: 640pxmd: 768pxlg: 1024pxxl: 1280px
UI Component Patterns
Working with Cards
Card is a compound component with semantic subcomponents.
Working with Buttons
Button supports variants, sizes, loading states, and icon sections.
default: Standard buttonprimary: Primary actionsecondary: Secondary actiondestructive: Dangerous actionsoutline: Outlined styleghost: Minimal stylelink: Link-styled button
Working with Typography
UseTitle for headings and Text for body content.
Title order mapping:
order={1}:<h1>tagorder={2}:<h2>tagorder={3}:<h3>tag- (continues to
order={6})
Working with Badges
UseBadge for status indicators and labels.
default: Standard badgesuccess: Green/positivewarning: Yellow/cautionerror: Red/negativeoutline: Outlined style
Semantic HTML Workflow
UseBlock with the component prop to render semantic HTML5 elements.
section: Thematic groupingarticle: Self-contained contentnav: Navigation linksheader: Introductory contentfooter: Footer contentaside: Sidebar contentmain: Main content area
Common Development Scenarios
Scenario 1: Building a Feature Card
Scenario 2: Building a Form Layout
When form-specific components are not available, compose layouts usingBlock and Box.
Scenario 3: Building a Dashboard Section
Scenario 4: Responsive Navigation
Data Attribute Targeting
All UI components includedata-class attributes for semantic targeting in CSS and tests.
Workflow Summary Table
| Task | Components to Use | Key Props | Pattern |
|---|---|---|---|
| Vertical layout | Stack | gap, align | Stacking elements vertically |
| Horizontal layout | Group | gap, justify | Arranging elements horizontally |
| Grid layout | Grid, GridCol | cols, gap, span | Multi-column responsive layouts |
| Content card | Card + subcomponents | p, rounded, shadow | Card.Header → Content → Footer |
| Semantic container | Block | component, variants | Section, article, nav, etc. |
| Interactive button | Button | variant, size, loading states | Action triggers |
| Typography | Title, Text | order, size, weight | Headings and body text |
| Status indicator | Badge | variant, size, dot | Labels and status |
| Centered content | Container | size, centered | Responsive max-width layouts |
| Form layout | Block, Box | Spacing and border variants | Custom form compositions |