Controller glyphs
Every controller input a game names in its prompts, as one reusable glyph that dips, lights and teaches.
controller-glyphs/controller-glyphs.tsxFace buttons
Shoulders
Directions
Right stick
Left stick
Prompts
The live component, numbered part by part. Every measurement is read from it as it is drawn. Point at a row to outline its part, or at a part to find its row.
The choices it offers, each value drawn live and the default marked, with how to pick one.
When to use
- Telling a player which input does what, in a prompt over the game: “A Jump”, “ZL Aim”, “press the left stick to crouch”.
- A tutorial that teaches a move: a stick glyph with its arrows (tilt, press, rotate) and
animateplaying the hint for a few seconds. - Showing that an input was taken:
presseddips the glyph and flashes it while the button is held,litkeeps it glowing. - A controls screen, a pause menu or a help sheet that lists every input of a pad in one consistent drawing.
- Prompts drawn over anything: every shape carries its own dark edge and every label its own dark plate, so they read on sky, snow, a white menu or a black one.
When not to use
- Keyboard shortcuts in an app or on a website. Use key caps (a kbd element) with the platform’s own keys.
- Clickable actions in a web UI. Use a button with words; a glyph alone names an input, it is not a control.
- Another pad’s own buttons (a cross, circle, square and triangle layout). These glyphs draw one family of pad; draw that pad’s set instead.
- A whole action bar with cooldowns and charges. Use a quick selector or ability icons and put a small glyph on each slot.
- Inside running text at body size. Under about 20 px the edge and the arrows close up; set the input in words, or use the glyph at sm or larger beside the line.
Pressed, lit or hinting
pressedwhile the player holds the input, so they see it was taken. Drive it from the real input; a pressed stick leans instead of dipping.litfor the input the game is waiting for. One at a time.animateto teach a move that’s more than a press: a tilt, a click-in, a spin. It plays for a few seconds; turn it off and on again to show it once more.
Placement
- In a corner or along an edge, in the same place every time, so the player learns where to look.
- Over the object it acts on (a door, a lever), as a glyph alone or with one word.
- In the order of the pad: face buttons together, shoulders together, sticks last, not shuffled by how often they’re used.
Each one drawn with the component itself, used well or badly.
The words say what the input does in the game, never which input it is: the glyph says that.
- A verb, one or two words:
Jump,Aim,Open door. They sit on one line and never wrap. - Sentence case, with no full stop.
- The action, not the input:
Jump, notPress A. - The same verb everywhere: if the tutorial says Crouch, the prompt says Crouch, not Duck.
- Change the words when the action changes: near a door,
A Open; in a dialog,A Confirm.
You can add this component with the shadcn CLI or by hand:
Into components/controller-glyphs of any React project, with no setup:
npx shadcn@latest add https://brunodelorence.com/r/controller-glyphs.json- Copy the component files
Copy these files into one folder of your project, keeping their relative imports together, or download them as a ZIP:
- Import it
As shown under Usage, below.
Either way it needs React 19 and a bundler that supports CSS Modules, such as Next.js or Vite. It has a dark colour scheme: it follows your page’s color-scheme, light unless the page sets one, or its colorScheme prop, with nothing to configure. Browsers without light-dark() show it light.
Usage
import { Glyph } from './controller-glyphs';export function InteractPrompt({ held }: { held: boolean }) { return ( <p> <Glyph name="A" size="lg" pressed={held} label="Open" labelPosition="left" /> <Glyph name="LS" motion="horizontal" animate label="Steer" /> <Glyph name="dpad" direction="up" size="md" lit /> </p> );}Each state below is a live instance, locked so you can study it.
The pieces it is built from, each with its measurements read live.
The badges a game uses to say which input to use: face buttons, plus and minus, shoulder tabs, the d-pad, the direction buttons and both sticks with arrows for tilt, press and rotate, alone or with words beside them. Each is one Glyph with sizes, a press that dips and springs back with a flash, a glow, and looping hints. Press them, play the sheet with the keyboard or a gamepad, or watch a short run of play.
- Every glyph is an SVG on one grid, where a face button’s box is 40 units: a round badge of 32 (27 for plus and minus), a tab slanted on its outer side, a trigger whose top rises to the outer corner, a cross of 32.5 with arms of 10.5, four direction buttons of 10.5 in a diamond, and a stick drawn from the side, an oval cap with a rim and a thin groove on a short foot.
- Letters and marks are not painted: an SVG mask cuts them out of the tan shape, over a dark edge drawn behind (the same shape filled and stroked near-black 1.2 units out all round), so every glyph carries its own crisp outline and reads on a light stage and a dark one alike. Arrows laid over a stick are cut around in the same way, so a press arrow sits in a notch of the cap.
- The SVG is sized in em of --glyph-size, the box of a face button, so size sets one number: sm 24, md 32, lg 40 (the kit’s own), xl 56 or any px; a label beside, before or under it is 0.6 of it, semibold, on a dark pill of its own.
- pressed dips the glyph to 0.86 in 70 ms and springs it back over 340 ms with an overshoot (a cubic-bezier past 1); a ring of light opens and fades behind it on each press. A pushed stick’s cap leans 2.6 units the way it goes, or sinks when pressed in, and its arrows nudge out.
- lit adds a glow behind the sharp shapes (two drop-shadows), warm white on a dark stage and amber on a light one; the opaque edge keeps it out of the cut letters. animate loops the hint: tilt arrows nudge out, the press arrow bobs into a squashed cap, the rotate arrows swing, a marked direction blinks.
- On the sheet, inputs are ids (A, dpad-up, LS-left…) and one input presses every glyph that names it: the plain stick, its tilt and its either-way glyphs, and a prompt. Pointer, Enter and Space press a glyph while held; with focus on the sheet the keyboard plays a pad (A B X Y, Q E, 1 3, + −, arrows, Shift + arrows); a gamepad is read each frame once it shows up.
- A demo plays a short run of play while it is on screen and untouched (walk, jump, aim and throw, quick items, crouch, look around, menu), with the last input as a prompt at the foot; any input hands it to the reader. The stage is plain, white or near-black through light-dark() tokens; the glyphs keep their colours on both.
| Prop | Type | Default | Description |
|---|---|---|---|
size | 'sm' | 'md' | 'lg' | 'xl' | number | — | On both. Glyph: the box of a face button in px, sm 24, md 32, lg 40 (the kit’s), xl 56; without it, --glyph-size (40 px). ControllerGlyphs: the size of every glyph on the sheet, by default 48 px on a wide stage, 40 under 760 px, then 32 and 26. |
gamepad | boolean | true | ControllerGlyphs: reads a connected gamepad (it shows up after its first press), each frame while the sheet is on screen. |
onInput | (input: string) => void | — | ControllerGlyphs: called with each input the reader presses ('A', 'dpad-up', 'LS-left'…). |
autoplay | boolean | true | ControllerGlyphs: while on screen and untouched, a short run of play on the sheet. |
colorScheme | 'light' | 'dark' | 'system' | — | ControllerGlyphs: the stage’s colours, light, dark or the reader’s system setting. Without it the component follows the page’s color-scheme. |
className | string | — | Extra class for the root (on both components). |
name | 'A' | 'B' | 'X' | 'Y' | 'plus' | 'minus' | 'L' | 'R' | 'ZL' | 'ZR' | 'dpad' | 'buttons' | 'LS' | 'RS' | — | Glyph: which input it names. Required. |
direction | 'up' | 'down' | 'left' | 'right' | 'all' | — | Glyph: for the d-pad and the direction buttons, the one to mark (or all buttons). |
motion | 'none' | 'left' | 'right' | 'horizontal' | 'press' | 'up' | 'down' | 'vertical' | 'rotate' | 'none' | Glyph: for a stick, the arrows that say how to move it. |
pressed | boolean | false | Glyph: held down; it dips and lights, and springs back when released. |
lean | 'up' | 'down' | 'left' | 'right' | — | Glyph: the way a pressed stick’s cap leans; by default its motion’s. |
lit | boolean | false | Glyph: glowing, for the input the game wants noticed. |
animate | boolean | false | Glyph: loops its hint (arrows nudge, the press arrow bobs, a marked direction blinks). |
label | ReactNode | — | Glyph: words beside it, as in a prompt. |
labelPosition | 'left' | 'right' | 'below' | 'right' | Glyph: where the words go. |
title | string | — | Glyph: its accessible name; by default “A button”, “Left stick, tilt left”… |
Screen readers
- A glyph is an image (
role="img") named by its input: “A button”, “D-pad up”, “Left stick, tilt left”.titlereplaces that name. - Its words are plain text after it, so a prompt reads as the input, then the action.
- A glyph is not a control. When it can be pressed, wrap it in a
<button>, as the sheet and the playground do.
Motion
animate plays the hint for under five seconds and then holds still, so nothing keeps moving beside other content (WCAG 2.2.2, A); turning it off and on plays it again. The sheet’s demo stops for good at the reader’s first input. Under reduced motion the hints, the flash and the springs don’t play; the arrows still say how to move.
Contrast
The cut letters show the near-black edge through the tan, and the words are warm white on a dark plate, both well above 4.5:1, and the sheet’s group captions are at least 4.9:1 on the stage in either scheme (1.4.3, AA). The edge outlines every shape on a light stage, and the tan stands out on a dark one (1.4.11, AA).
Not by glow alone
Lit is a glow, and pressed is a dip and a flash: say in words, too, what the game is waiting for, so the player doesn’t have to spot a glow to know (1.4.1, A).
In this build
- Each glyph is an image with a spoken name (“A button”, “D-pad up”, “Right stick, rotate”); its SVG is hidden, and a label beside it is real text.
- On the sheet, every glyph is a button in a named group per section, reached with Tab, pressed with Enter or Space while held, with a visible focus ring; a focused or hovered glyph loops its hint.
- The keyboard plays the pad only while focus is on the sheet, so the page’s own keys are never taken; the keys are listed in How it works.
- A polite live region says each input the reader presses and its action (“A button, Jump”), never the demo’s.
- Under reduced motion presses and leans change at once, nothing loops, flashes or blinks, and the demo never plays.
The complete source behind this demo. Open source under the MIT license, © 2026 Bruno Delorence: copy it, change it, ship it.
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useCallback, useEffect, useEffectEvent, useState, type KeyboardEvent, type PointerEvent,} from 'react';import { Glyph, describeGlyph, type GlyphDirection, type GlyphName, type GlyphSize, type StickMotion,} from './glyph';import { useAutoplay } from './use-autoplay';import styles from './controller-glyphs.module.css';/*// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useId, type CSSProperties, type ReactNode } from 'react';import styles from './glyph.module.css';/* * Glyph: one controller input as a game draws it in its prompts, flat tan inside a dark edge. * * - Each glyph is an SVG on a grid where a face button's box is 40 units: a round badge of 32, a * slanted shoulder tab, a cross, four direction buttons, or a stick seen from the side (an oval * cap with a rim, on a short foot), with arrows that say how to move it. * - The letter is not painted: it is cut out of the tan shape by a mask, over a dark edge drawn * behind (the same shape, filled and stroked 2.4 units wider), so the glyph reads on a light * stage and a dark one alike, as a game's prompts read on any scene. Arrows that overlap a * stick are cut around in the same way, and get their own edge. * - Its size is the box's, in px: the SVG is drawn in em of it, so a 40 px glyph is the kit's * own, and a label beside it is 0.6 of it (24 px). * - pressed dips it in 70 ms and springs it back with an overshoot on release, with a flash of * light; a stick leans the way it is pushed. lit makes it glow. animate plays its hint for under * five seconds, then holds still (WCAG 2.2.2): arrows nudge out, the press arrow bobs, the * rotate arrows swing, a marked direction blinks. Turning it off and on plays it again. *//* Controller glyphs (controller-glyphs.tsx): a plain stage with the sheet of glyphs on it, in groups, centred, and the last input at its foot as a prompt. The glyphs are 48 px on a wide stage, 40 (the kit's) under 760 px, 32 under 560, 26 under 380 (a container query), or the size prop. Colours are the tokens below, light-dark(light, dark) where the two differ: only the stage and its captions change, white by day and near-black at night; the glyphs keep their tan inside a dark edge, and their words sit on dark plates, so they read on both, as a game's prompts do. Motion lives in glyph.module.css; here, only the keys' hover and focus. */.root { /* The stage, its edge, and the captions over each group. */ --surface: #fff; --line: rgb(0 0 0 / 0.06); --caption: rgb(23 25 29 / 0.62); /* The keys: hover wash and focus ring. */ --key-hover: rgb(0 0 0 / 0.05); --focus: #387bff; position: relative; container-type: inline-size; isolation: isolate; display: flex; flex-direction: column;/* Glyph (glyph.tsx): one controller input. Its size is --glyph-size, the box of a face button (40 px, as the kit draws it); the SVG is sized in em of it, and a label is 0.6 of it. Colours: the tan of the shapes, the dark edge behind them that the letters are cut into, the label's warm white on its dark plate, and the glow. A game keeps its prompts' colours on any scene, so the shapes, the edge and the plate are the same on a light stage and a dark one; only the glow changes, a warm white on dark and an amber that shows on light. Crispness: the shapes are plain SVG fills and strokes, never blurred; a glow is a drop-shadow behind them, so the shapes themselves stay sharp at any pixel ratio. Motion: a press dips the art in 70 ms and springs it back with an overshoot (transitions of scale and translate), with a flash of light (a keyframe on a ring behind it); a pushed stick's cap leans the way it goes; animate plays the hints (keyframes on the arrows and marks) for under five seconds, a whole number of rounds so each ends at rest, then holds still until animate is turned off and on again (WCAG 2.2.2). */.glyph { --glyph-ink: #e2ded3; /* The dark edge round every shape, and the plate behind the words. */ --glyph-edge: #1d1c19; --glyph-plate: rgb(29 28 25 / 0.86); --glyph-text: #efe8da; --glyph-glow: rgb(255 249 228 / 0.85);// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useCallback, useEffect, useRef, useState } from 'react';/* * When a demo may play on its own: while part of it is on screen and the tab is visible, never * under reduced motion, and never again once the reader has used it: `take()` hands it to the * reader for good, until the component mounts again (WCAG 2.2.2). `visible` alone says whether it * is on screen in a visible tab, for clocks that should stop when nobody can see them. */export function useAutoplay<T extends HTMLElement>() { const ref = useRef<T>(null); const [visible, setVisible] = useState(false); const [reduced, setReduced] = useState(true); const [taken, setTaken] = useState(false); useEffect(() => { const element = ref.current; if (!element) return; let onScreen = false; const update = () => setVisible(onScreen && !document.hidden); const observer = new IntersectionObserver(