Search
Search for a page

Button

Used to trigger an action, such as opening a dialog or submitting a form.

bunx shadcn-svelte@latest add https://ui.grgurevic.click/r/button.json

Sizes

The default size is medium.

Variants

The default variant is prominent.

Prefix and suffix

Buttons can have prefix and suffix icons.

Best practices

The best practices when using buttons.

  • Choose clear, verb-first text (e.g., "Save Changes" or "Delete Project") rather than vague labels like "Submit" or "OK".
  • Use only one Prominent button per view to draw focus to the primary action. Use Secondary, Bordered, or Translucent variants for fallback choices, and Ghost for other tools.
  • Only use the Destructive variant for dangerous actions. Consider pairing it with a confirmation prompt or logoDialog to prevent accidental data loss.
  • Set the disabled property to prevent user interaction during loading or when required fields are missing, maintaining a predictable UI.

Props

The props available for the Button component.

PropTypeDefaultDescription
variant"prominent" | "bordered" | "secondary" | "translucent" | "ghost" | "destructive""prominent"The visual style variant of the button.
size"xs" | "sm" | "default" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg""default"The size variation of the button (including icon-only shapes).
hrefstringundefinedIf provided, renders the button as an anchor tag `<a>`.
magneticbooleantrueEnables the physics-based elastic magnetic pulling effect towards the cursor.
scalebooleantrueEnables tactile spring scaling response when pressed.
specularbooleantrueEnables dynamic 3D specular highlight reflections that track cursor movement.
specularAnglenumberundefinedOptional fixed angle for the specular light reflection.
liquidGlassbooleanfalseEnables physical liquid glass refraction distortion (Chromium only).
refractiveIndexnumber2.4Index of refraction (IOR) for the glass surface curvature. Range 1.0 (air) to 2.4.
bezelWidthnumber20Depth of the glass bezel refraction boundary zone (px).
displacementScalenumber40Strength of the physical refraction displacement offset.
surfaceProfile"circle" | "squircle" | "concave" | "lip""squircle"3D bezel outline profile contour style.
chromaticAberrationbooleanfalseEnables realistic RGB channel prism splitting refraction at bezel edges.
saturationBoostnumber1.3Color saturation boost multiplier inside refracted zone.
backgroundBlurnumber0.3Pre-blur factor applied to background to hide SVG rendering artifacts.