Pixel

Slant / Primitives

The slanted pixel, the kit's mark, in every tone and any size.

Demo

Usage

@tuttn/slant
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

PropTypeDefaultDescription
toneTone | 'current''accent'The colour; `current` paints it in the surrounding text colour.
sizenumber8Width and height, in pixels.
…restHTMLAttributes—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} with role="img" and an aria-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.