Skip to content
Haze UI

Sign-in provider button

Sign-in button for a provider or method, such as Continue with Google or Sign in with a passkey, with an icon slot and a last-used tag.

pnpm dlx shadcn@latest add @haze/oauth-button
Open preview in a new tab
Liveno JavaScript

When to use

  • Listing the ways to sign in or sign up on a login screen, one button per provider or method
  • Marking the method the person used last so they can pick it again quickly
  • A generic icon for email, passkey, SSO or phone sign-in without drawing any brand mark

When not to use

  • A general action such as Save or Delete; use button
  • Several related actions grouped in one bar; use button-group

Installation

Add the Haze registry to components.json once, then install Sign-in provider button with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/oauth-button
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
providerstring"Google"Provider name used in the default label "Continue with {provider}" when method is "provider".
method"provider" | "email" | "passkey" | "sso" | "phone""provider"Picks the default label and a generic icon (mail, key, building, phone). "provider" draws no icon unless you fill the icon slot.
labelstring–Replaces the default label. Keep the provider or method in it so the accessible name stays clear.
variant"outline" | "solid""outline"outline is a raised key (border, card fill, resting shadow); solid is the primary fill.
size"sm" | "md" | "lg""md"Height 32, 40 or 44 px.
fullWidthbooleanfalseStretches to the width of its container; a stack of these lines up at one width.
loadingbooleanfalseShows a spinner, disables the button and sets aria-busy. The label stays in the DOM and the width does not change. Buttons only, not links.
lastUsedbooleanfalseAdds a small bordered "Last used" tag after the label. It is text, so it does not rely on color.
hrefstring–Renders an <a> to your provider's authorize URL instead of a <button>.
type"button" | "submit" | "reset""button"Button type when no href is set.
icon (slot)named slot–Where you place the provider's official mark, taken from the provider's own brand guidelines. The wrapper is aria-hidden and sizes the svg to 16 px.
classstring–Extra classes, merged with tailwind-merge.
...attributesHTML button or anchor attributes–Passed to the <button> or <a>: name, value, form, formaction, aria-describedby, data attributes.

Keyboard interactions

EnterSpace
Activate (Space only for <button>)

Accessibility

  • The visible label is the accessible name and always includes the provider or method ("Continue with GitHub"), so a screen reader list of buttons is distinguishable. If you override label, keep the provider in it.
  • Icons, generic or slotted, are aria-hidden and never the only content. This component draws no brand marks; put the provider's official mark in the icon slot and follow that provider's brand guidelines for size, color and spacing.
  • "Last used" is visible text inside the button, so it is read as part of the name and does not depend on color.
  • A loading button is disabled and aria-busy. Its label stays in the DOM, hidden from sight, so the name does not change while it works.
  • Keyboard focus shows a 2 px outline with a 2 px offset; the smallest size is 32 px tall and the label truncates with an ellipsis rather than overflowing at narrow widths.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Sign-in provider button" with `npx shadcn@latest add @haze/oauth-button`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import OauthButton from "@/components/haze/ui/oauth-button.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/oauth-button.md

  • Customize with real content

    Adapt the Haze oauth-button ui for our product. Replace the demo values of these props with our real content: provider, method, label, variant, size, fullWidth, loading, lastUsed, href, type, icon (slot), class, ...attributes. Keep the layout, the heading level rules and these accessibility details: The visible label is the accessible name and always includes the provider or method ("Continue with GitHub"), so a screen reader list of buttons is distinguishable. If you override label, keep the provider in it. Icons, generic or slotted, are aria-hidden and never the only content. This component draws no brand marks; put the provider's official mark in the icon slot and follow that provider's brand guidelines for size, color and spacing. "Last used" is visible text inside the button, so it is read as part of the name and does not depend on color. A loading button is disabled and aria-busy. Its label stays in the DOM, hidden from sight, so the name does not change while it works. Keyboard focus shows a 2 px outline with a 2 px offset; the smallest size is 32 px tall and the label truncates with an ellipsis rather than overflowing at narrow widths. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using oauth-button, check it fits: use it when listing the ways to sign in or sign up on a login screen, one button per provider or method; marking the method the person used last so they can pick it again quickly; a generic icon for email, passkey, sso or phone sign-in without drawing any brand mark. Avoid it when a general action such as save or delete; use button; several related actions grouped in one bar; use button-group. Alternatives: @haze/button, @haze/button-group.

Dependencies

  • npm: @lucide/astro
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog