Skip to content

Component Page Template

Component Name provides a brief, impactful way to [describe component’s main purpose]. Use it to [primary use case] across your application.

A minimal implementation of the Component with default settings.

<Component variant='primary'>Default Component</Component>
PropertyTypeDefaultDescription
variant'primary' | 'secondary' | 'outlined''primary'Determines the visual style of the component
size'sm' | 'md' | 'lg''md'Controls the size of the component
disabledbooleanfalseWhen true, disables the component
onClickfunction-Function to be called when the component is clicked
VariableDefaultDescription
--component-primary-color#3b82f6Primary color used for the component
--component-secondary-color#6b7280Secondary color used for styling
--component-radius0.375remBorder radius for component edges

The default variant with solid background color.

<Component variant='primary'>Primary Component</Component>
<Preview>
<Component variant='primary'>Primary Component</Component>
</Preview>

A less prominent style for secondary actions.

<Component variant='secondary'>Secondary Component</Component>
<Preview>
<Component variant='secondary'>Secondary Component</Component>
</Preview>

A bordered style with transparent background.

<Component variant='outlined'>Outlined Component</Component>
<Preview>
<Component variant='outlined'>Outlined Component</Component>
</Preview>
<Component size='sm'>Small Component</Component>
<Preview>
<Component size='sm'>Small Component</Component>
</Preview>
<Component size='md'>Medium Component</Component>
<Preview>
<Component size='md'>Medium Component</Component>
</Preview>
<Component size='lg'>Large Component</Component>
<Preview>
<Component size='lg'>Large Component</Component>
</Preview>
<Component disabled>Disabled Component</Component>
<Preview>
<Component disabled>Disabled Component</Component>
</Preview>
<Component loading>Loading...</Component>
<Preview>
<Component loading>Loading...</Component>
</Preview>
<Component>
<IconLeading />
Leading Icon
</Component>
<Preview>
<Component>
<IconLeading />
Leading Icon
</Component>
</Preview>
<Component>
Trailing Icon
<IconTrailing />
</Component>
<Preview>
<Component>
Trailing Icon
<IconTrailing />
</Component>
</Preview>

The Component follows WAI-ARIA practices for accessibility:

  • Uses appropriate semantic elements
  • Supports keyboard navigation
  • Includes proper ARIA attributes
  • Maintains sufficient color contrast
  • Use primary variants for main actions
  • Choose secondary or outlined variants for less important actions
  • Maintain consistent spacing around components
  • Use clear, concise labels
  • Pair with icons only when they add meaning
Terminal window
npm install @your-library/component
import { Component } from '@your-library/component';
function App() {
return (
<div>
<Component variant='primary' onClick={() => console.log('Clicked!')}>
Click Me
</Component>
</div>
);
}
  • Allow for ample whitespace around the component
  • Maintain consistent padding and margin patterns
  • Use color to communicate intent or state
  • Follow your design system’s color and typography rules
:root {
--component-primary-color: #8b5cf6;
--component-secondary-color: #a78bfa;
--component-radius: 0.5rem;
}
<ThemeProvider
theme={{
component: {
primaryColor: '#8b5cf6',
secondaryColor: '#a78bfa',
borderRadius: '0.5rem',
},
}}>
<App />
</ThemeProvider>
<form onSubmit={handleSubmit}>
<Input name='email' />
<Component type='submit'>Submit Form</Component>
</form>
<ComponentGroup>
<Component variant='primary'>Save</Component>
<Component variant='outlined'>Cancel</Component>
</ComponentGroup>
<Preview>
<ComponentGroup>
<Component variant='primary'>Save</Component>
<Component variant='outlined'>Cancel</Component>
</ComponentGroup>
</Preview>

You can override the CSS variables or use the theme provider to change the colors across your application.

Yes, you can pass any icon component as a child to the Component.

When used within a form, set the type property to “submit” to trigger the form’s submit event.