This site documents Colibri, a framework-agnostic component library for building web UIs in JavaScript/Typescript. Colibri was designed and is maintained by Telesign.
Our documentation system is built using Storybook, providing an interactive environment for documenting components, design guidelines, and usage patterns.
- Overview
- Getting Started
- Documentation Structure
- Writing Documentation
- Development
- Customization
- Best Practices
- Contributing
- Interactive component playground
- Web Components support
- Accessibility testing
- Responsive preview
- Theme switching
- Code snippets
- Framework integration guides
# Install dependencies
npm install
# Start development server
npm run dev
# Build documentation
npm run build
The documentation system requires:
- Node.js (latest LTS)
- npm or yarn
- Modern browser for development
All web components must be registered in .storybook/preview.ts
before they can be used in stories:
// .storybook/preview.ts
import { registerColibriComponents, registerAllComponents } from '@telesign/colibri';
import { ColIcon } from '@telesign/colibri-icons';
import '@telesign/colibri/styles/styles.css';
// Register all components from @telesign/colibri
registerAllComponents();
// Register external components like icons separately
registerColibriComponents([ColIcon]);
This ensures components are available globally across all stories. Never register components in individual story files.
colibri-docs/
├── src/
│ ├── assets/ # Static assets
│ ├── constants/ # Shared constants
│ ├── styles/ # Global styles
│ └── stories/ # Component documentation
│ └── components/ # Component stories
└── .storybook/ # Storybook configuration
├── preview.ts # Global configuration and component registration
└── main.ts # Storybook configuration
All story files should follow this standard organization:
- External dependencies first
- Local imports second
- Story-specific type definitions
- Props interfaces
- Component documentation
- Props configuration (argTypes)
- Default args
- Parameters (including
__sb
for layout)
- Story-specific styles using lit's css
- Placed before stories for context
- Individual story implementations
- Story-specific documentation
For a complete example of this organization, see ColIcon.stories.tsx. This story demonstrates:
- Proper file structure
- Component documentation
- Props configuration
- Layout customization
- Multiple story variants
- Styled components
After registering a component in preview.ts
, you can use it in your stories:
// ComponentName.stories.ts
export const Default = () => html`
<col-icon name="home" size="24px" color="currentColor"></col-icon>
`;
Control how source code appears in your documentation with these options:
To exclude decorators and show only the component code:
parameters: {
docs: {
source: {
excludeDecorators: true;
}
}
}
To remove specific elements (like <style>
tags) from the displayed source code:
parameters: {
docs: {
source: {
transform: (code: string): string => {
// Remove style tags and their content
return code.replace(/<style>[\s\S]*?<\/style>\s*/, '');
};
}
}
}
To hide the source code for specific stories:
parameters: {
docs: {
source: {
code: null; // Disables the "Show code" option
}
}
}
For a complete example of source code customization, see ColIcon.stories.tsx.
Stories can be configured with custom layouts using the __sb
parameter:
parameters: {
__sb: {
display: 'grid' | 'flex',
gridTemplateColumns?: string,
gap?: string,
flexDirection?: 'row' | 'row-reverse' | 'column' | 'column-reverse',
justifyContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly',
flexWrap?: 'nowrap' | 'wrap' | 'wrap-reverse'
}
}
- Files should be placed in the
stories/components
directory - File name should be
ComponentName.stories.ts
- Story title should follow
Category/ComponentName
format
Available Category
values:
Atoms
Molecules
Organisms
Tokens
A story file for a molecule component is available for reference at ExampleTextField.stories.tsx.
This file demonstrates:
- Usage of a molecule component (with slots and nested elements)
- Custom tokens usage for styling (e.g. colors.border.default)
- A custom transform function to clean up displayed source code
- Story structure and props setup following best practices
{
"dev": "storybook dev -p 6006",
"build": "storybook build"
}
Installed addons include:
- @storybook/addon-essentials
- @storybook/addon-a11y
- @storybook/addon-links
Stories are organized in a specific order:
- Welcome
- Atoms
- Molecules
- Organisms
- Tokens
This ordering is configured in the preview configuration:
options: {
storySort: {
order: ['Welcome', 'Atoms', 'Molecules', 'Organisms', 'Tokens'],
}
}
The system supports theme switching through the data-theme
attribute:
decorators: [
(story, context) => html` <div data-theme=${context.args.mode || 'default'}>${story()}</div> `,
];
- Component Documentation
- Overview
- Props/API
- Examples
- Best practices
- Accessibility considerations
- Code Examples
- Basic usage
- Common patterns
- Edge cases
- Writing Style
- Clear and concise
- Consistent terminology
- Progressive disclosure
- Include visual examples
- Testing
- Use a11y addon
- Test with screen readers
- Keyboard navigation
- Color contrast
- Documentation
- ARIA roles
- Keyboard interactions
- Screen reader behavior
- Fork the repository
- Create feature branch
- Make changes following the story organization guidelines
- Submit pull request
- Documentation review
- Technical review
- Accessibility review
- Final approval
- File Organization
- Follow standard story file structure
- Use consistent naming
- Maintain clear hierarchy
- Code Examples
- Follow style guide
- Include comments
- Show best practices
After setup:
- Review existing documentation
- Identify gaps
- Plan documentation structure
- Create contribution guidelines
- Set up automated deployment