Hairline
Borders and rings exactly one device pixel wide on every screen, through one variable the whole theme reads.
Hairline is part of the HextaUI theme. If you've added the theme or any component, you have it.
pnpm dlx shadcn@latest add https://hextaui.com/r/theme.jsonOr add it to your global CSS by hand.
You rarely need to reach for it. The theme makes it the default border width, so border, border-t and divide-y all draw hairlines. Use the variable directly where Tailwind has no default, like rings, outlines and lines drawn with a background.
A CSS pixel covers two or three physical pixels on most screens, so a 1px border is really two or three device pixels thick. --hairline divides by the display's pixel ratio so every line is exactly one device pixel, the way native apps draw separators. On a standard display it stays 1px.
| Pixel ratio | Description |
|---|---|
1× | 1px |
1.5× | 0.667px |
2× | 0.5px |
3× | 0.333px |
4× | 0.25px |
Lists and cards
Plain border and divide-y. Thinner separators group rows without boxing them in.
- Plan
- Pro
- Seats
- 12
- Billing
- Yearly
- Renews
- Mar 4, 2027
- HextaUI components draw edges with
inset-ring-(length:--hairline)rather than borders. An inset ring takes no layout space, so a state that changes the ring's color or width never shifts the content. - Hairlines are lighter on the page, so a border color tuned for 1px lines may look faint. The theme's
--borderis tuned for hairlines. - Use
border-2or wider for emphasis, like a selected card. Those stay in CSS pixels.
| Name | Description |
|---|---|
--hairline | One device pixel, in CSS pixels. |
border-hairline | Sets border-width to --hairline. |
--default-border-width | Set to --hairline, so border and divide default to it. |