|
| 1 | +# tailscale-ui-components |
| 2 | + |
| 3 | +Tailscale UI component library used by Tailscale web projects. Not maintained for external use. |
| 4 | + |
| 5 | +## Development Setup |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +Ensure you have the following tools installed: |
| 10 | + |
| 11 | +- **Node.js 22.14.0** (use `nvm` to manage Node versions) |
| 12 | + ```bash |
| 13 | + nvm use 22.14.0 |
| 14 | + ``` |
| 15 | +- **Yarn 1.22.19** (package manager) |
| 16 | + ```bash |
| 17 | + |
| 18 | + ``` |
| 19 | + |
| 20 | +### Getting Started |
| 21 | + |
| 22 | +1. **Clone the repository** |
| 23 | + ```bash |
| 24 | + git clone https://github.com/tailscale/tailscale-ui-components.git |
| 25 | + cd tailscale-ui-components |
| 26 | + ``` |
| 27 | + |
| 28 | +2. **Install dependencies** |
| 29 | + ```bash |
| 30 | + yarn install |
| 31 | + ``` |
| 32 | + |
| 33 | +3. **Start Storybook for development** |
| 34 | + ```bash |
| 35 | + yarn storybook |
| 36 | + ``` |
| 37 | + This will start Storybook on `http://localhost:6006` (or the next available port) |
| 38 | + |
| 39 | +### Available Scripts |
| 40 | + |
| 41 | +- `yarn storybook` - Start Storybook development server |
| 42 | +- `yarn build-storybook` - Build Storybook for production |
| 43 | +- `yarn build` - Build the component library for production |
| 44 | +- `yarn test` - Run tests with Vitest |
| 45 | + |
| 46 | +### Environment Compatibility |
| 47 | + |
| 48 | +This project has been tested and works with: |
| 49 | +- **Node.js 22.14.0** (recommended for team consistency) |
| 50 | + |
| 51 | +### Package Management |
| 52 | + |
| 53 | +This project uses **Yarn v1** as the package manager. The `yarn.lock` file should be committed, and `package-lock.json` should be ignored/removed if present. |
| 54 | + |
| 55 | +### Component Development |
| 56 | + |
| 57 | +Components are located in `src/components/` and follow these patterns: |
| 58 | + |
| 59 | +1. **OSS-ready structure** with proper style mappings |
| 60 | +2. **Comprehensive TypeScript types** and exported constants |
| 61 | +3. **Accessibility features** with proper ARIA attributes |
| 62 | +4. **Storybook stories** for documentation and testing |
| 63 | + |
| 64 | +Example component structure: |
| 65 | +``` |
| 66 | +src/components/button/ |
| 67 | +├── button.tsx # Main component |
| 68 | +├── button.stories.tsx # Storybook stories |
| 69 | +``` |
| 70 | + |
| 71 | +### Styling Guidelines |
| 72 | + |
| 73 | +- Use the `.button`, `.input`, and other base CSS classes from `src/tailwind.css` |
| 74 | +- Follow the established design tokens and color system |
| 75 | +- Ensure components have rounded corners and consistent spacing |
| 76 | +- Support both light and dark themes |
| 77 | + |
| 78 | +### Contributing |
| 79 | + |
| 80 | +**Branch Workflow:** |
| 81 | + |
| 82 | +There are many components and stories for those components already ported over from corp to this UI library. They live in the **staging branch**. When making updates to components, adding stories, etc., please submit the PR towards that staging branch. **Main will only contain components that we're actively using in corp and other repos**. |
| 83 | + |
| 84 | +When adding or modifying components: |
| 85 | + |
| 86 | +1. Ensure TypeScript strict mode compliance |
| 87 | +2. Add comprehensive Storybook stories |
| 88 | +3. Include proper accessibility attributes |
| 89 | +4. Follow the established component patterns |
| 90 | +5. Export components from `src/index.ts` |
| 91 | + |
| 92 | +### Troubleshooting |
| 93 | + |
| 94 | +**Node.js Version Issues:** |
| 95 | +If you encounter build errors, ensure you're using Node.js 22.14.0: |
| 96 | +```bash |
| 97 | +node --version # Should output v22.14.0 |
| 98 | +``` |
| 99 | + |
| 100 | +**Package Manager Issues:** |
| 101 | +If dependencies fail to install, try: |
| 102 | +```bash |
| 103 | +rm -rf node_modules yarn.lock |
| 104 | +yarn install |
| 105 | +``` |
0 commit comments