404
Lost signal. This page is not here.
import { GlitchText } from '@brand-studio/ui';
export default function GlitchTextDemo() {
return (
<div style={{ display: 'grid', justifyItems: 'center', gap: 12, textAlign: 'center' }}>
<div style={{ font: '800 clamp(5rem, 22vw, 9rem)/1 ui-monospace, SFMono-Regular, Menlo, monospace', letterSpacing: '-.04em' }}>
<GlitchText text="404" />
</div>
<p style={{ margin: 0, color: 'var(--bs-muted)' }}>Lost signal. This page is not here.</p>
</div>
);
}Installation
pnpm add @brand-studio/uinpm install @brand-studio/uiyarn add @brand-studio/uibun add @brand-studio/uiInstall the peer dependencies
npm install react react-domImport the stylesheet once
import '@brand-studio/ui/styles.css';Wrap your app in a brand theme
import { BrandTheme, GlitchText } from '@brand-studio/ui'; import brand from './brand.json'; <BrandTheme palette={brand.tokens} mode="system"> {/* your app */} </BrandTheme>
Usage
import { GlitchText } from '@brand-studio/ui';<NotFound art={<GlitchText text="404" />} />It takes the font and size of its parent, so set those on the element around it. Keep it to a number or a word or two.
Accessibility
- Screen readers hear the text once; the two torn copies are hidden from them.
- The tear lasts a fraction of a second every three seconds and never flashes the whole text.
- Under reduced motion the slices hold still as one fixed tear.
API Reference
| Prop | Type | Default |
|---|---|---|
text | string | – |
as? | React.ElementType | – |
className? | string | '' |