BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/better-auth-ui/api-key

API Key

better-auth-ui/api-key
FreeComponent

API Key plugin: list, create, copy, and revoke API keys. Registers an API Keys security card in account settings.

Live preview

live · rendered by the registry
Rendered by better-auth-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://better-auth-ui.com/r/api-key.json

Source

src/components/auth/api-key/api-key.tsxbetter-auth-ui.com/r/api-key.json
1"use client"
2
3import {
4 type ListedApiKey,
5 useAuth,
6 useAuthPlugin
7} from "@better-auth-ui/react"
8import { Key, X } from "lucide-react"
9import { useState } from "react"
10
11import { Button } from "@/components/ui/button"
12import {
13 Item,
14 ItemActions,
15 ItemContent,
16 ItemDescription,
17 ItemMedia,
18 ItemTitle
19} from "@/components/ui/item"
20import { apiKeyPlugin } from "@/lib/auth/api-key-plugin"
21import { DeleteApiKeyDialog } from "./delete-api-key-dialog"
22
23export type ApiKeyProps = {
24 apiKey: ListedApiKey
25 /** Hide the row's delete button (e.g., when caller lacks `apiKey:delete`). */
26 hideDelete?: boolean
27 /** Scope the delete payload to an organization (sets `configId`). */
28 organizationId?: string
29}
30
31export function ApiKey({ apiKey, hideDelete, organizationId }: ApiKeyProps) {
32 const { localization } = useAuth()
33 const { localization: apiKeyLocalization } = useAuthPlugin(apiKeyPlugin)
34 const [deleteOpen, setDeleteOpen] = useState(false)
35
36 const preview = `${apiKey.start}${"*".repeat(16)}`
37
38 return (
39 <Item>
40 <ItemMedia variant="icon">
41 <Key />
42 </ItemMedia>
43 <ItemContent>
44 <ItemTitle>{apiKey.name || apiKeyLocalization.apiKey}</ItemTitle>
45 <ItemDescription className="font-mono">{preview}</ItemDescription>
46 <ItemDescription>
47 {apiKeyLocalization.created}{" "}
48 {new Date(apiKey.createdAt).toLocaleString(undefined, {
49 dateStyle: "medium",
50 timeStyle: "short"
51 })}
52 </ItemDescription>
53 <ItemDescription>
54 {apiKey.expiresAt
55 ? `${apiKeyLocalization.expires} ${new Date(
56 apiKey.expiresAt
57 ).toLocaleString(undefined, {
58 dateStyle: "medium",
59 timeStyle: "short"
60 })}`
61 : apiKeyLocalization.neverExpires}
62 </ItemDescription>
63 </ItemContent>
64 <ItemActions>
65 {!hideDelete && (
66 <>
67 <Button
68 variant="outline"
69 size="sm"
70 onClick={() => setDeleteOpen(true)}
71 aria-label={apiKeyLocalization.deleteApiKey}
72 >
73 <X />
74
75 {localization.settings.delete}
76 </Button>
77
78 <DeleteApiKeyDialog
79 open={deleteOpen}
80 onOpenChange={setDeleteOpen}
81 apiKey={apiKey}
82 organizationId={organizationId}
83 />
84 </>
85 )}
86 </ItemActions>
87 </Item>
88 )
89}

What it pulls in

npm packages

  • @better-auth-ui/react@latest
  • @better-auth-ui/core@latest
  • @better-auth/api-key
  • lucide-react

Other registry items

  • alert-dialog
  • button
  • card
  • dialog
  • empty
  • field
  • input
  • input-group
  • item
  • label
  • select
  • separator
  • skeleton
  • sonner
  • spinner

Files it writes

  • src/lib/auth/auth-plugin.ts
  • src/lib/auth/api-key-plugin.ts
  • src/components/auth/api-key/api-keys.tsx
  • src/components/auth/api-key/api-key.tsx
  • src/components/auth/api-key/api-keys-empty.tsx
  • src/components/auth/api-key/api-key-skeleton.tsx
  • src/components/auth/api-key/create-api-key-dialog.tsx
  • src/components/auth/api-key/new-api-key-dialog.tsx
  • src/components/auth/api-key/delete-api-key-dialog.tsx
  • src/components/auth/api-key/organization-api-keys.tsx

Facts

Registry
better-auth-ui
Type
registry:component
Access
Free
Files written
10
Licence
MIT
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

Docs on better-auth-ui better-auth-ui.com better-auth-ui/better-auth-ui on GitHub Raw registry item This item as JSON

More from better-auth-ui

All 49 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Account Settingsaccount-settingsbetter-auth-uiComponentsFree2 deps
Active Sessionsactive-sessionsbetter-auth-uiComponentsFree5 deps · 2 files
Additional Fieldadditional-fieldbetter-auth-uiComponentsFree5 deps
Adminadminbetter-auth-uiComponentsFree4 deps · 3 files
Anonymousanonymousbetter-auth-uiComponentsFree4 deps · 3 files
Authauthbetter-auth-uiComponentsFree2 deps
Auth Providerauth-providerbetter-auth-uiComponentsFree4 deps · 2 files
Auth Redirectauth-redirectbetter-auth-uiComponentsFree3 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex