Skip to main content
Spacedrive’s UI is built on a set of reusable primitives from @sd/ui. These components provide consistent styling and behavior across the application.

Design Principles

Composition Over Configuration

Primitives are simple, composable building blocks rather than complex configured components.

Semantic Color Usage

All primitives use semantic color tokens, never raw Tailwind colors.

Consistent Patterns

Common patterns are standardized across primitives: Card Pattern:
List Item Pattern:
Table Pattern:

Core Primitives

Button

Versatile button component with multiple variants and sizes.
Variants:
  • default - Transparent with border, hover/active states
  • gray - App button background with hover/focus states
  • accent - Accent blue background with white text
  • subtle - Transparent border, subtle hover
  • outline - Sidebar line border style
  • dotted - Dashed border for add/create actions
  • colored - Custom colored backgrounds (pass bg color class)
  • bare - No styling whatsoever
Sizes:
  • xs - Extra small (px-1.5 py-0.5, text-xs)
  • sm - Small (px-2 py-0.5, text-sm) - default
  • md - Medium (px-2.5 py-1.5, text-sm)
  • lg - Large (px-3 py-1.5, text-md)
  • icon - Square icon button (!p-1)
Best Practice: Wrap icons and text in flex containers to prevent stacking:

Input

Form input with semantic styling and size variants.
Variants:
  • default - Standard input with border and background
  • transparent - Transparent background, no border on focus
Sizes:
  • xs - 25px height
  • sm - 30px height (default)
  • md - 36px height
  • lg - 42px height
  • xl - 48px height
Props:
  • error - Shows error state (red border/ring)
  • icon - Icon component or React node
  • iconPosition - 'left' | 'right' (default: 'left')
  • right - React node to display on the right side
  • inputElementClassName - Additional classes for the input element itself
Additional Components:
  • SearchInput - Input with MagnifyingGlass icon pre-configured
  • PasswordInput - Input with eye icon toggle for show/hide password
  • TextArea - Multi-line text input with same styling system
  • Label - Semantic label component with slug prop for htmlFor

Form Components

React Hook Form integration with automatic validation display.

Switch

Toggle switch for boolean settings.

ShinyToggle

Animated toggle component for switching between multiple options with a smooth glowing indicator.
Features:
  • Smooth animated indicator using Framer Motion
  • Gradient background with glow effect
  • Optional count badges
  • Type-safe with generics
  • Fully accessible
Props:
  • value - Current selected value (generic type T)
  • onChange - Callback when selection changes
  • options - Array of { value: T, label: ReactNode, count?: number }
  • className - Additional classes for the container
Context menu and dropdown with Radix UI.

Glassmorphism Effect

Spacedrive’s signature glassmorphism effect combines backdrop blur, transparency, and gradient borders.
Noise Variants:
  • noise - Base noise texture
  • noise-faded - Faded intensity
  • noise-sm - Small grain size

Progress Bars

Consistent progress bar pattern for resource usage.
Color by type:
  • Storage: bg-accent (blue)
  • AI/Compute: bg-purple-500
  • Bandwidth: bg-green-500
  • Progress: bg-accent
  • Success: bg-green-400

Status Badges

Standard status badge pattern.

Empty States

Pattern for when lists/grids are empty.

Gradients

Background Gradients

Border Gradients

Typography Scale

Consistent text sizing across the app.
Scale:
  • text-xs (12px) - Helper text, labels
  • text-sm (14px) - Body text, descriptions
  • text-base (16px) - Default body
  • text-lg (18px) - Subheadings
  • text-xl (20px) - Section titles
  • text-2xl (24px) - Card titles
  • text-3xl (30px) - Page titles

Icons

Use Phosphor Icons with consistent sizing and weights.
Weight Guidelines:
  • regular - Default, inactive states
  • fill - Active states, buttons, emphasis
  • bold - Strong emphasis

Spacing Scale

Consistent spacing using Tailwind’s scale. Common patterns:
  • Card padding: p-6
  • Button padding: px-3 py-1.5 (md), px-2.5 py-1.5 (sm)
  • Section spacing: space-y-4 or space-y-6
  • Grid gaps: gap-4 or gap-6
  • Icon-text gap: gap-2 or gap-3

Accessibility

Color Contrast

All semantic colors meet WCAG AA standards:
  • text-ink on bg-app - AAA
  • text-ink-dull on bg-app-box - AA
  • text-ink-faint on bg-app-input - AA (minimum)

Focus States

Interactive elements include focus rings:

Keyboard Navigation

All interactive primitives support keyboard navigation out of the box via Radix UI.