Pixel
Slant / Primitives
The slanted pixel, the kit's mark, in every tone and any size.
Demo
Usage
import { Pixel, Row, Text } from '@tuttn/slant'
<Pixel /> // accent, 8px
<Pixel tone="danger" size={12} />
// It's decorative: say what it means in text beside it.
<Row gap={8}><Pixel tone="success" /><Text>Ada K. is online</Text></Row>
// current paints it in the surrounding text colour.
<Button variant="primary"><Pixel tone="current" />Deploy</Button>Props
| Prop | Type | Default | Description |
|---|---|---|---|
tone | Tone | 'current' | 'accent' | The colour; `current` paints it in the surrounding text colour. |
size | number | 8 | Width and height, in pixels. |
…rest | HTMLAttributes | — | className, style and every other attribute go on the <span>, and a ref reaches it. A width or height in style wins over size. |
Accessibility
- Every pixel renders with
aria-hidden="true", so screen readers skip it. Say what it means in text beside it, never with the colour alone. - To make one pixel meaningful on its own, override that:
aria-hidden={false}withrole="img"and anaria-label.
The shape is an 8px square with 2px corners, skewed 9° by --sl-slant: the backslant of the TUTTN logo. The skew is a transform, so the pixel keeps its square layout box and lines up in a row like any inline block. Badge's pixel and Chip's pixel and pulse indicators are this component; Switch's knob, Slider's thumb and the typing dots share its slant.