No.24 · Buttons
Entry Ring Button
A pill whose gradient border draws itself from exactly where your cursor crossed the edge, growing both ways round to meet on the far side, and shrinks away toward where you leave.
The prompt
Written for the variant you picked above: Night
Build a dark pill button (52px, hairline ring) with an SVG outline measured by a ResizeObserver: a pill path with pathLength=1, stroked 2px with a diagonal frost → lilac → amber gradient and a soft drop-shadow glow. At rest the dash is '0 1', so nothing shows. On pointerenter, project the pointer onto the outline and express it as a fraction s of the way round. Show a single dash centred on s: dasharray 'len 1−len' with dashoffset −(s − len/2). Jump to len 0 at s, then transition len to 1 (620ms ease-in-out, dasharray and dashoffset together, so the centre stays put): the line grows both ways from your entry point and meets on the far side. On pointerleave, project the exit point, re-centre the full ring on it with no transition (invisible at full length), then transition len back to 0, so the line shrinks away toward where you left. Keyboard focus grows it from the middle of the bottom edge. Pressing fades in the same gradient as the face (scale 0.85 → 1) and turns the label to ink. Selected variant — Night (night): Palette for this theme (Night): --erb-a #b9cce4; --erb-b #c8b9ea; --erb-c #f0b37a; --erb-edge rgb(239 232 220 / 0.14); --erb-face #141217; --erb-glow rgb(200 185 234 / 0.55); --erb-ink #efe8dc; --erb-ink-on #141216. Treat these as the root colour tokens, one value per role, and name them to suit your code. Select it with the theme option set to "night". Keep every dimension, spacing value, state and motion from the brief unchanged, and keep text at 4.5:1 contrast or better on these surfaces. 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: Enter from any side and the border draws from that point; leave and it retracts toward the exit. Press to flood the face. Motion: Draw and retract 620ms ease-in-out; press flood 120–200ms. Accessibility: A real button with its text as the label; the outline is aria-hidden. Focus draws the ring and adds an outline. Reduced motion makes the ring appear instantly. Responsive behavior: The outline is rebuilt from the measured size, so it fits any label. Touch: No ring on touch; pressing floods the face as feedback. 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
- Enter from any side and the border draws from that point; leave and it retracts toward the exit. Press to flood the face.
- Motion
- Draw and retract 620ms ease-in-out; press flood 120–200ms.
- Accessibility
- A real button with its text as the label; the outline is aria-hidden. Focus draws the ring and adds an outline. Reduced motion makes the ring appear instantly.
- Responsive
- The outline is rebuilt from the measured size, so it fits any label.
- On touch
- No ring on touch; pressing floods the face as feedback.