ConsentCard

OAuth-style consent. Each permission is a row you can untick unless it is required, and the allow button counts what you are granting. Auth.

Open playground
Ledgerly wants accessto your Northwind Bank account

About

ConsentCard is a React component in the Auth category of smoui. It is typed, ships no stylesheet, follows your theme through CSS variables, and honors prefers-reduced-motion. Import it with import { ConsentCard } from "@ashutoshswamy/smoui" and set appName, appMark, account among its 6 props.

Install

Terminal
npm i @ashutoshswamy/smoui

Usage

TSX
import { ConsentCard } from "@ashutoshswamy/smoui";

<ConsentCard
  appName="Ledgerly"
  account="your bank account"
  scopes={[{ id: "profile", label: "Your name and email", required: true }, { id: "balances", label: "View balances" }]}
  onAllow={(granted) => authorize(granted)}
  onDeny={cancel}
/>

Props 6

appName

The app asking for access.

string
appMark

Logo. Defaults to the first letter of the name.

ReactNode
account

What is being connected, shown under the title.

string
scopes

Each has id, label, description and required.

ConsentScope[]
onAllow

Gets the ids left ticked.

(granted: string[]) => void | Promise
onDeny

Called by the Deny button.

() => void