# Component Usage Guide
How to use design system components in the DSS Admin UI and other projects.
## Navigation Components
### Navigation Sections
Group related navigation items with section headers.
```html
```
**Classes**:
- `.nav-section`: Container for related items
- `.nav-section__title`: Section header (uppercase, muted)
- `.nav-item`: Individual navigation item
- `.nav-item__icon`: Icon within navigation item
- `.nav-item.active`: Active/current page state
- `.nav-item--indent-1`: Indentation level 1
- `.nav-item--indent-2`: Indentation level 2
**States**:
- `:hover`: Light background, darker text
- `:focus-visible`: Ring outline at 2px offset
- `.active`: Primary background, lighter text
## Buttons
### Button Variants
```html
Save Changes
Cancel
Learn More
Delete
```
**Variants**:
- `.btn-primary`: Main call-to-action
- `.btn-secondary`: Secondary action
- `.btn-ghost`: Tertiary action
- `.btn-destructive`: Dangerous action (delete, remove)
**Sizes**:
- `.btn-sm`: Small button (compact UI)
- (default): Standard button
- `.btn-lg`: Large button (primary CTA)
**States**:
- `:hover`: Darker background
- `:active`: Darkest background
- `:disabled`: Reduced opacity, cursor not-allowed
- `:focus-visible`: Ring outline
## Form Controls
### Input Fields
```html
Description
Team
Select a team...
Design
Engineering
```
**Classes**:
- `.form-group`: Container for input + label
- `.form-group__help`: Helper text (muted)
- `.form-group__error`: Error message (destructive color)
**Input Types**:
- `input[type="text"]`
- `input[type="email"]`
- `input[type="password"]`
- `textarea`
- `select`
**States**:
- `:focus`: Border to ring color
- `:disabled`: Muted background
- `.form-group__error`: Display error below input
## Cards & Panels
### Basic Card
```html
Card Title
Card content goes here.
```
### Card Variants
```html
Content with shadow
Content with border only
```
### Panel with Structure
```html
```
**Classes**:
- `.card`: Basic card container
- `.card--elevated`: Card with shadow
- `.card--outlined`: Card with border
- `.panel`: Structured container
- `.panel__header`: Header section with title
- `.panel__title`: Panel heading
- `.panel__body`: Main content area
- `.panel__footer`: Footer with actions
## Help Panel (Collapsible)
```html
Need Help?
Getting Started
Create a new project
Import design tokens
Apply to your UI
Keyboard Shortcuts
Cmd+K: Search
Cmd+/: Toggle sidebar
```
**Classes**:
- `.help-panel`: Details element wrapper
- `.help-panel__toggle`: Summary (clickable title)
- `.help-panel__content`: Content container (hidden by default)
- `.help-section`: Section within content
- ``: Section header
**States**:
- `.help-panel[open]`: Content visible
## Notification Indicator
```html
```
**Classes**:
- `.notification-toggle-container`: Container for relative positioning
- `.status-dot`: Small indicator dot
## Utility Classes
### Flexbox
```html
Centered content
```
**Flex Utilities**:
- `.flex`: Display flex
- `.flex-col`: Flex direction column
- `.flex-row`: Flex direction row (default)
- `.justify-start`, `.justify-center`, `.justify-end`, `.justify-between`, `.justify-around`
- `.items-start`, `.items-center`, `.items-end`
### Gaps & Spacing
```html
Content with gap, padding, margin
```
**Gap Utilities**: `.gap-1` through `.gap-6`
**Padding**: `.p-1`, `.p-2`, `.p-3`, `.p-4`, `.p-6`
**Margin**: `.m-1`, `.m-2`, `.m-3`, `.m-4`, `.m-6`
### Text & Typography
```html
Small muted text
Heading
Colored text
```
**Text Size**: `.text-xs` through `.text-2xl`
**Font Weight**: `.font-400` through `.font-700`
**Text Color**: `.text-foreground`, `.text-muted`, `.text-primary`, `.text-destructive`, `.text-success`, `.text-warning`
### Background & Borders
```html
Styled container
```
**Background**: `.bg-surface`, `.bg-muted`, `.bg-primary`, `.bg-destructive`
**Border**: `.border`, `.border-none`, `.border-top`, `.border-bottom`
**Border Radius**: `.rounded`, `.rounded-sm`, `.rounded-md`, `.rounded-lg`, `.rounded-full`
### Display & Visibility
```html
Not visible
Block element
Inline-block element
```
**Display**: `.hidden`, `.block`, `.inline-block`, `.inline`
**Overflow**: `.overflow-hidden`, `.overflow-auto`, `.overflow-x-auto`, `.overflow-y-auto`
**Opacity**: `.opacity-50`, `.opacity-75`, `.opacity-100`
## Responsive Design
Media queries are handled in Layer 5 (`_responsive.css`):
```css
/* Tablets and below */
@media (max-width: 1023px) {
.sidebar {
display: none;
}
}
/* Mobile only */
@media (max-width: 639px) {
button {
width: 100%;
}
}
```
**Breakpoints**:
- `1024px`: Tablet/desktop boundary
- `640px`: Mobile/tablet boundary
## Accessible Components
All components are built with accessibility in mind:
### Focus Management
```html
Action
```
### Labels for Inputs
```html
Email Address
```
### Navigation Semantics
```html
```
### Color Contrast
- All text meets WCAG AA or AAA standards
- Never rely on color alone to convey information
### Motion Preferences
Consider user preferences:
```css
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms !important;
transition-duration: 0.01ms !important;
}
}
```
## Dark Mode
All components automatically respond to dark mode:
```css
@media (prefers-color-scheme: dark) {
/* Dark theme colors applied automatically */
}
```
Users can also set theme explicitly:
```html
```
## Best Practices
1. **Use semantic HTML**: ``, ` `, ``, ``
2. **Combine utilities**: Mix classes for flexibility
3. **Maintain spacing consistency**: Always use spacing scale
4. **Test contrast**: Especially for custom colors
5. **Keyboard test**: Ensure all interactive elements are keyboard accessible
6. **Mobile first**: Design for mobile, enhance for larger screens
7. **Respect motion preferences**: Reduce animations for users who prefer it