Overview
Stride Design System is built with TypeScript and provides comprehensive type definitions for all components. Get full IntelliSense support, type checking, and autocompletion in your IDE.Type Exports
Component Props Types
Every Stride component exports its props interface:Using Exported Types
VariantProps Pattern
Extracting Variant Types
Stride usesclass-variance-authority for type-safe variants:
src/components/ui/Button/Button.tsx
Type Inference Benefits
- IntelliSense
- Type Safety
- Default Values
ForwardRef Pattern
Type-Safe Refs
All Stride components properly type refs usingReact.forwardRef:
src/components/ui/Button/Button.tsx
Using Refs
Component Interface Patterns
Standard Component Props
Here’s the complete pattern used across all Stride components:React Aria Components
For components using React Aria, extend from Aria props:src/components/ui/Input/Input.tsx
Advanced Type Patterns
Polymorphic Components
Create components that can render as different elements:Discriminated Unions
Use discriminated unions for mutually exclusive props:Type Utilities
ClassValue Type
Thecn() utility accepts various input types:
src/lib/utils.ts
Component Prop Type Extraction
Extract prop types from existing components:IntelliSense Benefits
Auto-completion
Auto-completion
Get suggestions for all component props, variants, and values as you type.
Inline Documentation
Inline Documentation
Hover over any prop to see its documentation and type information.
Error Detection
Error Detection
Catch type errors before runtime with instant feedback.
Refactoring Safety
Refactoring Safety
Rename components or props with confidence - TypeScript finds all usage.
Best Practices
Always Export Types
Export component prop types for consumers to extend and reuse.
Use VariantProps
Let cva generate variant types automatically for consistency.
Proper Ref Types
Specify correct element type in forwardRef for accurate ref typing.
Extend Native Types
Extend from HTMLAttributes or React Aria types for standard HTML props.
Example: Building a Type-Safe Component
Here’s a complete example combining all patterns:Next Steps
Styling Guide
Learn about Tailwind CSS v4 and styling patterns
SSR Guide
Configure components for server-side rendering