Legend Indicator Properties
Simple circular indicators for data visualization legends, status indicators, and category markers. Available in various colors and sizes to represent different states or data series.
Installation
Add Legend Indicator to your project with the CK-UI CLI. It copies the source into your project, so the code is yours to change.
- Adds
LegendIndicator.tsxto your CK-UI folder (src/components/ck-ui by default)- Installs
@radix-ui/react-slotif your project does not have them yet
First time with CK-UI in this project? Run npx ck-ui-cli@latest init once before adding components. The installation guide explains what it sets up.
Manual installationInstall the packages and copy the files yourself.
Install the following dependencies
Run these commands in your terminal to install the required packages
Create or update your LegendIndicator component
Copy this code to create your LegendIndicator component
Test Your Component
- 1. Add the component to a test page
- 2. Check all props and variants work as expected
- 3. Verify responsive behavior
- 4. Test with different content/data
- 5. Ensure accessibility features work correctly
Style Colors
All colors work in both light and dark modes.
Sizes
Each size maintains consistent visibility across different screen sizes.
Custom size
Add custom sizes by using Tailwind utility classes.
API Reference
The LegendIndicator component provides a simple way to create colored circular indicators for various use cases.
LegendIndicator
Circular indicator component with customizable size and color options. Children (for example a small icon) are centred inside the dot.
| Prop | Type | Default | Description |
|---|---|---|---|
color | "neutral""gray""blue""indigo""orange""red""green""yellow""purple""pink""teal" | "gray" | Color of the indicator |
size | "sm""md""lg" | "md" | Size of the indicator. small, medium and large are deprecated aliases. |
label | "string" | "undefined" | Accessible name (exposed as role="img"). Without it the indicator is decorative (aria-hidden), so show a visible text label next to it: color alone does not convey meaning. |
asChild | "boolean" | "false" | Render the single child element instead of a span, merging the indicator props onto it |
className | "string" | "undefined" | Additional CSS classes for the indicator, merged last (e.g. custom size and border width) |
variant | "string" | "undefined" | Deprecated alias of color |