Sign-in Button
<x-wirekit:: is the button that signs someone in with another service: Google, Apple, Facebook, PayPal or Amazon. Each service sets out how its button looks, its colors, the words on it and where its logo sits, and each button follows its service's rules, so a page that offers all five shows them side by side without one looking out of place. A passkey signs in through the browser rather than another service, and its button stands beside them, see A Passkey.
Basic Usage
service names the service and href the route that starts the sign-in with it, usually the redirect of Laravel Socialite. The button is as wide as its container, the way a sign-in page stacks them, and says "Continue with" and the service's name.
The Logos
WireKit ships no logo of these services. Each of them asks that its button carries its own artwork, downloaded from its own brand page under its own terms, and Amazon asks for its own button images. Download each logo you need once, put it where your pages load images from, and name it in config/:
// config/wirekit.php
'sign_in' => [
'logos' => [
// 1. Google's "G", from the assets of its branding guidelines
'google' => '/images/sign-in/google.svg',
// 2. Apple's logo for a button with words, from Apple Design Resources
'apple' => '/images/sign-in/apple.svg',
// 3. The "f" logo, from Meta's brand resource center
'facebook' => '/images/sign-in/facebook.svg',
// 4. The PayPal monogram, from PayPal's logos and marks
'paypal' => '/images/sign-in/paypal.svg',
// 5. Amazon's whole button image, from its Login with Amazon button guidelines
'amazon' => '/images/sign-in/amazon.png',
// 6. The passkey icon of the FIDO Alliance
'passkey' => '/images/sign-in/passkey.svg',
],
],
Where each one comes from:
- Google: the Sign in with Google branding guidelines. The "G" stays in its colors, at the size the button gives it.
- Apple: Apple Design Resources, the logo for a button with a title. Its file carries its own padding and is as tall as the button, as Apple's Human Interface Guidelines for Sign in with Apple ask.
- Facebook: the logo pack of the Facebook brand resources in Meta's brand resource center.
- PayPal: the monogram from PayPal's logos and marks, as the button design guide of Log in with PayPal names it.
- Amazon: a button image from the Login with Amazon button guidelines. Amazon allows its own buttons only, so for Amazon the file is the whole button.
- Passkey: the passkey icon of the FIDO Alliance, which the Alliance gives to sites that sign in with passkeys, through a form on its website and under its usage agreement. The icon is its trademark, and the agreement allows no changes to it, so it is used as it comes.
A service with no logo set shows its words alone. logo on the tag names a logo for one button, in place of the config.
Apple asks for its logo in the color of the button's words: white on the black button, black on the
white one and on outline. Its download carries both, and naming both lets each look take its own,
with auto taking the one the page's mode asks for:
// config/wirekit.php
'sign_in' => [
'logos' => [
// 1. Apple's logo in white, for the black button, and in black, for the white one
'apple' => [
'white' => '/images/sign-in/apple-white.svg',
'black' => '/images/sign-in/apple-black.svg',
],
],
],
A look whose color is missing from the list shows its words alone, since a logo in the other color is one Apple does not allow there. A single file, as above, holds for every look.
In forced colors, a Windows contrast theme among them, the button stands on the reader's own colors instead of Apple's black or white, and a logo keeps its own color. So the button carries every color named in the list, and the stylesheet shows the one that reads on the reader's colors: the black logo on a light theme, the white one on a dark theme.
Words
action chooses the words: continue ("Continue with Google", the default), sign-in ("Sign in with Google") or sign-up ("Sign up with Google"). Meta and PayPal name their own words for signing in, "Log in with", and none for signing up, so there sign-up continues. The words are translated with the rest of the kit; label replaces them for one button.
Variants
variant chooses among the looks a service allows, and each service's first is the default. Amazon has none: its button image is its look. A passkey has none either, since no brand sets its colors: it takes the page's.
| Service | Variants | Default |
|---|---|---|
auto, light, dark, neutral |
auto: light on a light page, dark on a dark one |
|
| Apple | auto, black, white, outline |
auto: black on a light page, white on a dark one, as Apple asks |
white, blue |
white |
|
| PayPal | blue, gray |
blue |
Facebook's white button comes first because of contrast: white words on Meta's blue, #1877f2, read at 4.23:1, short of the 4.5:1 that text of this size needs. variant="blue" gives Meta's blue for a page that takes that trade; the previews on this page hold to 4.5:1 and leave it out:
<x-wirekit::sign-in-button service="facebook" variant="blue" href="/auth/facebook/redirect" />
The colors are tokens, listed with the design tokens under "Sign-in Buttons"; they are the services' colors, so a preset leaves them alone.
pill gives the button round ends, a shape Google and PayPal offer. Without it the button takes the kit's corners, which Apple asks for: the corners of the other buttons on the page.
Amazon
Amazon allows its own button images only, so with its image set the image is the button, at the size the image has. Choose the image whose size and color suit the page from Amazon's guidelines; the button's words, "Login with Amazon", are what a screen reader reads for it.
<x-wirekit::sign-in-button service="amazon" href="/auth/amazon/redirect" />
Amazon gives each button in one size and in twice that size, 156 × 32 and 312 × 64 pixels for the
desktop button. Name both, and a screen with dense pixels takes the larger file at the size of the
smaller, so the button stays sharp at the height Amazon gives it. A 2x file named alone shows at
half its own size as well:
// config/wirekit.php
'sign_in' => [
'logos' => [
// 1. Amazon's button in one file per pixel density, written as srcset
'amazon' => [
'1x' => '/images/sign-in/amazon.png',
'2x' => '/images/sign-in/[email protected]',
],
],
],
Amazon's images carry their words, and Amazon offers them in several languages. A site in more than
one language names the image for the reader's language with logo on the tag:
<x-wirekit::sign-in-button service="amazon" href="/auth/amazon/redirect" :logo="[
'1x' => '/images/sign-in/amazon-'.app()->getLocale().'.png',
'2x' => '/images/sign-in/amazon-'.app()->getLocale().'@2x.png',
]" />
Without a Link
Without href the component is a <button>, for a sign-in that a Livewire action starts:
<x-wirekit::sign-in-button service="google" wire:click="signInWith('google')" />
It is type="button", so it does not send a form it stands in. Where the sign-in starts with a POST request, give it type="submit" inside the form:
<form method="POST" action="/auth/google/redirect">
@csrf
<x-wirekit::sign-in-button service="google" type="submit" />
</form>
block="false" keeps the button as wide as its words, for a row of buttons.
A Passkey
service="passkey" is the button for signing in with a passkey. It leads to no other service: the browser asks for the passkey, so the button takes no href and is a <button> from which your passkey script starts the sign-in. action chooses its words, "Continue with a passkey", "Sign in with a passkey" or "Sign up with a passkey", in every language of the kit. It takes the page's colors, in light and dark mode alike.
Every attribute reaches the button, so your script finds it by whatever it looks for, a data-* attribute as above or an id, and a Livewire or Alpine handler works as on any button:
<x-wirekit::sign-in-button service="passkey" action="sign-in" x-on:click="signInWithPasskey()" />
The FIDO Alliance's passkey icon shows beside the words once you name it under passkey in config/, see The Logos. Without it the button shows its words alone.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
service |
string | — | google, apple, facebook, paypal or amazon, or passkey, see A Passkey |
href |
string|null | null |
The route that starts the sign-in. Without it the component is a <button> |
action |
string | 'continue' |
The words: continue, sign-in or sign-up |
variant |
string|null | null |
A look the service allows, see Variants. Unset, the service's first |
logo |
string|array|null | null |
The logo's URL for this button. Unset, wirekit.sign_in.logos.<service>. Apple's logo can be given per color, ['white' => …, 'black' => …], and an image per pixel density, ['1x' => …, '2x' => …]. A list that names no file is reported |
label |
string|null | null |
The words, in place of the ones action gives |
pill |
bool | false |
Round ends, which Google and PayPal offer |
block |
bool | true |
As wide as its container. false: as wide as its words |
scope |
string|null | null |
Scoped personalization key |
Accessibility
- The button is a link, or a
<button>withouthref, named by its words. The logo beside them is hidden from a screen reader, since the words already name the service. - For Amazon the image is the button, and its alternative text is the button's words.
- The focus ring is the kit's, outside the button, so it shows on every service's colors.
- A link opened in a new tab with
target="_blank"carriesrel="noopener noreferrer", and its words end with a visually hidden "(opens in new tab)". - Google's, Apple's and PayPal's words read at 4.5:1 or more on their fills. Facebook's white button does too; its blue one reads at 4.23:1, see Variants.
Keyboard Interaction
| Key | Action |
|---|---|
Tab |
Moves the focus to the button, which shows the kit's focus ring |
Enter |
Follows the link to the service; on a button without href, runs its action |
Space |
Runs the action of a button without href |