Button

Trigger an action. Light shows it is in progress, succeeded or failed.

Resources

Promo code

Try WELCOME10.

Server response
Frames
0
Active effects
0
Renderer
none

When to use it

  • To submit a form, or for an action that waits for an answer (save, sync), with aria-busy.
  • Not to go to another page: use a link.

Recommendations

  • Put the submit button first in the form: it is the one that gets the "ready" pulse.
  • No disabled to enforce validity: let native validation stop the submission.
  • No effect on every click (onClick: "ripple" everywhere): one effect, one reason.

Accessibility

The library

  • Native <button> element, never disabled by the library: it keeps focus, and an incomplete form is stopped by native validation.
  • While sending, aria-busy is set, so it is announced; the orbit lasts 5 s at most.
  • Hover, press and focus in CSS, with 3:1 contrast.
  • Reduced motion: a simple fade. High contrast: system colors, no shader.

Integration

  • A failed submission explained by a text, announced with aria-live.
  • No disabled on a submit button: it loses focus, and the user does not know what is missing.

WCAG 2.2 criteria: Non-text Contrast · Animation from Interactions · Focus Visible · Error Identification · Status Messages

Props

PropTypePurpose
aria-busybooleanSet by the Form while sending, or by you: orbit and diode. Never disabled.
effects{ onClick: "ripple" }Effects triggered by DOM events.
onEffectEnd(e) => voidAlways called, even when the effect is skipped.

Spec

The normative spec for this component: Formulaire

Availability and resources

Status
available · open source
Packages
@shader-ui/react (React, Next.js)
@shader-ui/core (TypeScript, plain HTML)
Source code
button.ts (core) · Button.tsx (React)