For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /api/elements/apple-sign-in-button.md.

<apple-sign-in-button>

The button that starts Sign in with Apple, drawn as Apple's guidelines ask: the Apple logo, one of Apple's titles, its colors and its corners. App Review checks the button against them, so use this rather than drawing your own.

  • Its title is in the app's language, as Apple asks. The button the runtime draws off iOS takes it from the app's LOCALE_ID, which provideLocale() sets from the phone's language, in the words iOS's own button uses. It's English for a language iOS has no title in.
  • Lynx has no such element. This one is AngularLynx's.

Usage

src/app/sign-in.ts
import { Component, inject } from '@angular/core';
import { LYNX_ELEMENTS, LynxAppleSignIn } from '@blotch/angular-lynx';

@Component({
  selector: 'app-sign-in',
  imports: [LYNX_ELEMENTS],
  template: `
    <apple-sign-in-button
      type="continue"
      button-style="black"
      class="h-12 w-full"
      (bindtap)="signIn()"
    />
  `,
})
export class SignIn {
  readonly #appleSignIn = inject(LynxAppleSignIn);

  async signIn() {
    const result = await this.#appleSignIn.signIn({ scopes: ['email'] });
    // Send the result to your server.
  }
}

Import LYNX_ELEMENTS in your component (see Elements).

Give it a size, with classes or an inline style. Like iOS's own button, it has none of its own. Apple asks for at least 140 × 30, and 44 tall is the usual height. A CSS rule naming the tag (apple-sign-in-button { … }) styles only iOS's button: the one the runtime draws is a <view>, which it doesn't match. It takes no children.

Attributes

AttributeTypeDefaultDescription
type'signIn' | 'continue' | 'signUp''signIn'The title: "Sign in with Apple", "Continue with Apple" or "Sign up with Apple"
button-style'black' | 'white' | 'whiteOutline''black'Black with a white logo and title, white with black ones, or white outlined in black, for a white background
corner-radiusnumber | string6The corners' radius, in points on iOS and pixels elsewhere. Half the height makes a pill

Apple asks for a white button on a dark background, and a black one on a light background. So if the app follows the phone's light or dark appearance, switch button-style with it.

Events

bindtap, as on any element. Call LynxAppleSignIn.signIn() from it.

Platform support

WhereWhat draws it
iOS apps built with ng build --platform ios and signInWithAppleiOS's own ASAuthorizationAppleIDButton. Its title follows the phone's language, and it highlights while it's pressed
Android apps, the web preview, Lynx Explorer, and iOS apps without signInWithAppleThe runtime, to the same guidelines: the logo, the title in the app's LOCALE_ID, the colors and the corners

On Android, sign in through Apple's web flow with LynxWebAuthSession, where Apple's guidelines ask for the same button. In the web preview and Lynx Explorer, which have no sign-in, use isAvailable() to leave the button out.

Testing

In the testing library, the button is iOS's element while the fake Sign in with Apple module is there, as it is by default: document.querySelector('apple-sign-in-button') finds it, with its attributes. After setAppleSignInAvailable(false), it's the one the runtime draws, whose title screen.getByText('Sign in with Apple') finds in an English app. A spec that gives render() another LOCALE_ID in its providers finds that language's title. fireEvent.tap() taps either.