Skip to content

No.559 · Buttons· New

Prism Glass Button

A button cut from a slab of clear glass. Its thick edge works as a lens: at two opposite corners it shows ink split into colours, red against the edge, a dark core, blue within. Animated, the two fringes travel round the rim at a steady pace.

The prompt

Copy this text

Automatic copying is unavailable. Copy the selected text using your device’s copy command.

Written for the variant you picked above: Spectrum · still

Build a button that looks cut from a slab of clear glass with a thick, polished edge, in light and dark versions. The face is clear; all the colour is at the edge. Layout. A native button with a transparent background. Pill: height = size (64px by default), horizontal padding 62% of the size, corner radius 42% of it. Tile: a square of the size with a 27% radius, for a single icon. The label is ordinary text above the glass, 17px semibold, near-black on light glass and near-white on dark. Rim width 6.2% of the short side; lens depth 30% of it (24% on a tile); canvas margin 34%. One lap of the fringes takes 6 seconds by default. The glass. Draw it with one WebGL fragment shader on a canvas that is larger than the element by a margin, so the shadow and outer shell can sit outside the edge; output premultiplied alpha and leave the face fully transparent, so the slab works on any ground. Use a rounded-box signed distance d (negative inside). Rim: a flat band of the stated width just inside the edge, tinted white at 10% on light glass and 3% on dark, bounded by two fine lines (the outer edge and an inner bevel) that are brighter on the side facing a light from the top left. Light glass adds a soft shadow below it (black, 13%, falling off over a fifth of the lens depth). Dark glass adds instead a second, fainter outline outside the first, visible only on the left and right flanks. The fringes. Keep a unit "lean" direction, at rest pointing to the top right, so the lens favours the top-right and bottom-left corners. For each pixel take its position within the corner region (0 at the middle of an edge, 1 at the corner, per axis, signed), normalise it, and let w = smoothstep(0.76, 1, |dot(that, lean)|): 1 where the edge faces along the lean, falling to 0 away from it. The fringe is as thick as w^1.7 × the lens depth, varied by ±14% with a slow sine along the edge so it never reads as a ruled band. Across that thickness, s runs 0 at the outer edge to 1 at the inner side: colour is a four-stop gradient read from the outer stop at s = 0 to the inner stop at s = 1; a solid core of ink (near-black on light glass, near-white on dark) covers s 0.16–0.68 with soft ends, and only where the fringe is thick, so the thin tails are colour alone; opacity fades from s = 0.5 to 1. The result is one colour hugging the outer edge, a solid core, and a second colour bleeding softly into the face, tapering to a point along each edge. Motion. The only animation is the fringes travelling round the rim: rotate the lean direction at a constant rate, one full turn per lap, advancing by elapsed time (capped at 50ms a frame) so the pace is the same at any frame rate. Because the lens favours both ends of the lean, there are always two fringes, opposite each other, and they slide along the edges and round the corners together. Nothing follows the pointer and nothing eases or pulses. With motion set to "still", or under reduced motion, draw one frame with the fringes at the top-right and bottom-left corners and never animate. States. Pressed: the whole button scales to 0.96 for the length of the press; the glass itself does not react. Focus-visible: a 2px outline in the label colour, 6px out. Disabled: 45% opacity. Edge lines. With lines set to "none" the slab is drawn exactly the same except that the edge lines are left out: no rim band, no outer edge line, no inner bevel, no highlight lines along the edge and, on dark glass, no outer shell line. The fringes, their colours and motion and the light glass's shadow are unchanged. Dark glass without lines would vanish on black, so it gets a faint lift instead: white at 7.5% over the whole face, and its soft outer glow widens (falloff 0.22 of the lens depth instead of 0.1) and strengthens (26% instead of 10%). Production behaviour: pause the loop off screen and in hidden tabs, and resume from where the fringes were. Without WebGL fall back to plain inset rings with the same proportions. In forced-colours mode hide the canvas and give the button a border. Selected variant — Spectrum · still (spectrum-still): Fringe colours are the reference colours: cyan #3fd8ff innermost, deep blue #1a34ff, magenta #ff2aa0, and red #ff4530 against the outer edge. This version does not move at all: the fringes rest at the top-right and bottom-left corners. Select it with palette "spectrum" and motion "still". This selection takes precedence over references to other themes or options in the general brief. Implement this selected appearance; do not add a variant picker or alternative appearances unless requested. Implementation requirements: Use React and TypeScript. Keep the component self-contained, with uniquely scoped CSS and no animation libraries. Include required imports, styles and font setup in the result. Interaction: Nothing follows the pointer; a press scales the button slightly. Motion: Two fringes travel round the rim at a constant pace, one lap in six seconds. Accessibility: A native button with real text; the glass is a decorative canvas. Focus shows a 2px outline. Reduced motion draws one still frame. Responsive behavior: Sized by one number; every proportion of the glass follows the button's box. Touch: Nothing depends on hover. Preserve keyboard access, visible focus and reduced-motion behavior. Keep fictional demo data and simulated service calls in a separate usage example; expose callbacks for real actions and recover from rejected requests. Keep usage-example links inside the demo: use local buttons or prevent navigation. Demonstration links must not navigate to Vitrine routes or open other pages; preserve real URL support in the reusable component itself. Verify the result at narrow and wide viewport sizes, with keyboard input and reduced motion enabled.

Notes

Interaction
Nothing follows the pointer; a press scales the button slightly.
Motion
Two fringes travel round the rim at a constant pace, one lap in six seconds.
Accessibility
A native button with real text; the glass is a decorative canvas. Focus shows a 2px outline. Reduced motion draws one still frame.
Responsive
Sized by one number; every proportion of the glass follows the button's box.
On touch
Nothing depends on hover.