Core component library and design system patterns. Use when building UI, using design tokens, or working with the component library.
Add this skill
npx mdskills install sickn33/core-componentsComprehensive design system documentation with clear examples and token-first patterns.
1---2name: core-components3description: Core component library and design system patterns. Use when building UI, using design tokens, or working with the component library.4---56# Core Components78## Design System Overview910Use components from your core library instead of raw platform components. This ensures consistent styling and behavior.1112## Design Tokens1314**NEVER hard-code values. Always use design tokens.**1516### Spacing Tokens1718```tsx19// CORRECT - Use tokens20<Box padding="$4" marginBottom="$2" />2122// WRONG - Hard-coded values23<Box padding={16} marginBottom={8} />24```2526| Token | Value |27|-------|-------|28| `$1` | 4px |29| `$2` | 8px |30| `$3` | 12px |31| `$4` | 16px |32| `$6` | 24px |33| `$8` | 32px |3435### Color Tokens3637```tsx38// CORRECT - Semantic tokens39<Text color="$textPrimary" />40<Box backgroundColor="$backgroundSecondary" />4142// WRONG - Hard-coded colors43<Text color="#333333" />44<Box backgroundColor="rgb(245, 245, 245)" />45```4647| Semantic Token | Use For |48|----------------|---------|49| `$textPrimary` | Main text |50| `$textSecondary` | Supporting text |51| `$textTertiary` | Disabled/hint text |52| `$primary500` | Brand/accent color |53| `$statusError` | Error states |54| `$statusSuccess` | Success states |5556### Typography Tokens5758```tsx59<Text fontSize="$lg" fontWeight="$semibold" />60```6162| Token | Size |63|-------|------|64| `$xs` | 12px |65| `$sm` | 14px |66| `$md` | 16px |67| `$lg` | 18px |68| `$xl` | 20px |69| `$2xl` | 24px |7071## Core Components7273### Box7475Base layout component with token support:7677```tsx78<Box79 padding="$4"80 backgroundColor="$backgroundPrimary"81 borderRadius="$lg"82>83 {children}84</Box>85```8687### HStack / VStack8889Horizontal and vertical flex layouts:9091```tsx92<HStack gap="$3" alignItems="center">93 <Icon name="user" />94 <Text>Username</Text>95</HStack>9697<VStack gap="$4" padding="$4">98 <Heading>Title</Heading>99 <Text>Content</Text>100</VStack>101```102103### Text104105Typography with token support:106107```tsx108<Text109 fontSize="$lg"110 fontWeight="$semibold"111 color="$textPrimary"112>113 Hello World114</Text>115```116117### Button118119Interactive button with variants:120121```tsx122<Button123 onPress={handlePress}124 variant="solid"125 size="md"126 isLoading={loading}127 isDisabled={disabled}128>129 Click Me130</Button>131```132133| Variant | Use For |134|---------|---------|135| `solid` | Primary actions |136| `outline` | Secondary actions |137| `ghost` | Tertiary/subtle actions |138| `link` | Inline actions |139140### Input141142Form input with validation:143144```tsx145<Input146 value={value}147 onChangeText={setValue}148 placeholder="Enter text"149 error={touched ? errors.field : undefined}150 label="Field Name"151/>152```153154### Card155156Content container:157158```tsx159<Card padding="$4" gap="$3">160 <CardHeader>161 <Heading size="sm">Card Title</Heading>162 </CardHeader>163 <CardBody>164 <Text>Card content</Text>165 </CardBody>166</Card>167```168169## Layout Patterns170171### Screen Layout172173```tsx174const MyScreen = () => (175 <Screen>176 <ScreenHeader title="Page Title" />177 <ScreenContent padding="$4">178 {/* Content */}179 </ScreenContent>180 </Screen>181);182```183184### Form Layout185186```tsx187<VStack gap="$4" padding="$4">188 <Input label="Name" {...nameProps} />189 <Input label="Email" {...emailProps} />190 <Button isLoading={loading}>Submit</Button>191</VStack>192```193194### List Item Layout195196```tsx197<HStack198 padding="$4"199 gap="$3"200 alignItems="center"201 borderBottomWidth={1}202 borderColor="$borderLight"203>204 <Avatar source={{ uri: imageUrl }} size="md" />205 <VStack flex={1}>206 <Text fontWeight="$semibold">{title}</Text>207 <Text color="$textSecondary" fontSize="$sm">{subtitle}</Text>208 </VStack>209 <Icon name="chevron-right" color="$textTertiary" />210</HStack>211```212213## Anti-Patterns214215```tsx216// WRONG - Hard-coded values217<View style={{ padding: 16, backgroundColor: '#fff' }}>218219// CORRECT - Design tokens220<Box padding="$4" backgroundColor="$backgroundPrimary">221222223// WRONG - Raw platform components224import { View, Text } from 'react-native';225226// CORRECT - Core components227import { Box, Text } from 'components/core';228229230// WRONG - Inline styles231<Text style={{ fontSize: 18, fontWeight: '600' }}>232233// CORRECT - Token props234<Text fontSize="$lg" fontWeight="$semibold">235```236237## Component Props Pattern238239When creating components, use token-based props:240241```tsx242interface CardProps {243 padding?: '$2' | '$4' | '$6';244 variant?: 'elevated' | 'outlined' | 'filled';245 children: React.ReactNode;246}247248const Card = ({ padding = '$4', variant = 'elevated', children }: CardProps) => (249 <Box250 padding={padding}251 backgroundColor="$backgroundPrimary"252 borderRadius="$lg"253 {...variantStyles[variant]}254 >255 {children}256 </Box>257);258```259260## Integration with Other Skills261262- **react-ui-patterns**: Use core components for UI states263- **testing-patterns**: Mock core components in tests264- **storybook**: Document component variants265
Full transparency — inspect the skill content before installing.