Calm motion: animations on this site only fade, with no movement
API key field
A secret key, hidden by default, with show, copy, and make a new key
Shows a secret key on a settings page, so a person can copy it into an app. The key is hidden until the person asks to see it. For a password that a person types, use the password input.
Basic
Upload script
sk_demo_ … cD5fThe old key stops working at once. Apps that use it must get the new key.
valueis the key. While it is hidden, only its start, such assk_demo_, and its last four letters show. Screen readers hear the same short form.- The eye button shows or hides the full key. It is a toggle with
aria-pressed. - "Copy" copies the full key, also while it is hidden, and emits
copy. A hidden status line says "Copied". - "Make a new key" opens a confirm popup that says the old key stops working. Only the confirm emits
regenerate. Make the new key on your server, then setvalue.:regenerable="false"hides this button. name,created, andlast-usedadd the name of the key and two dates, as text.- Change the words with
labelsor a label pack:show,hide,copy,copied,regenerate,confirm,confirmLabel,cancel, andcreatedandlastUsed(functions of the date).
Usage
ts
import { BlessApiKeyField } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
value* | string | — | the secret key |
name | string | — | the name of the key, for example "Upload script" |
created | string | — | when the key was made, as text |
lastUsed | string | — | when the key was last used, as text |
regenerable | boolean | true | show the button that makes a new key; false hides it |
labels | Partial<{ show: string; hide: string; copy: string; copied: string; regenerate: string; confirm: string; confirmLabel: string; cancel: string; created: (when: string) => string; lastUsed: (when: string) => string; }> | — |
Events
| Name | Payload | Description |
|---|---|---|
copy | [] | |
regenerate | [] |