Skip to content
SLICES / TECHNICAL FOLIO Nº 001FULL-STACK ASSEMBLIES — OPEN SOURCE

Headless / Organizations

Join requests

Review and approve or reject workspace access requests.

14 public parts · 2examples

@slices.sh/auth/headlessView as Markdown ↗

Your design. Our behavior.

Explore the tree to see what each part controls. Gates reveal the relevant state; roots outline their scope.

Behavior / inputGateGenericRenderer · not headlessScope
COMPONENT ANATOMYHover · focus · tap
ONE POSSIBLE DESIGNStatic preview

User.Root · Scope

User.RootSays which auth the User parts below read, and whether they may do without it. The parts need no root: left out, they read the nearest auth root's config, or "default", and render nothing without auth. `<User.Root enabled="optional">` is for the one who wants that said in the code.

Installation

Choose what your component needs. Run these commands in an initialized Next.js app.

0

Before you start

The steps below run in a Next.js app with shadcn set up (it has a components.json). In an existing Next.js app, such as one from create-next-app, set shadcn up first:

npx shadcn@latest init -t next -b base -p nova

Or start fresh: the slices CLI creates the app and sets it up.

npx slices.sh install
1

Install the service registry

Adds services/index.ts, which import "@/services" loads. A provider setup writes the same file, so skip this if your app has one.

npx add services
2

Install the headless library

npm

Add the React parts to your app, then compose them with your own elements.

npm install @slices.sh/auth@^0.1.10

Import from @slices.sh/auth/headless.

3

Install the service

Connect the parts to a provider. Skip this step if this service is already configured in your app.

Provider
Database
Authentication methods
Account capabilities
npx add auth.betterauth --auth-methods google --organizations

Adds service configuration and API routes to your app, with the provider dependencies. For a headless composition, add import "@/services" after "use client".

The slices CLI installs the service and provisions its required resources in one command.

Set BETTER_AUTH_URL to your app origin. Memory is for local development; use a persistent database for deployment. Neon and Supabase also require the migration script printed by the installer.

Provider setup notes
  • BETTER_AUTH_SECRET signs every session and is generated into .env.local while this installs (32 random bytes, base64, nothing leaves the machine). Changing it signs everyone out; in production set the same one on every instance.
  • The public origin (OAuth callbacks, the passkey domain) is the one each request comes to in development, and the deployment's own on Vercel. Elsewhere, or behind a proxy or a custom domain, set BETTER_AUTH_URL, such as https://acme.com.

Start small

Parts bring the behavior. Use their default elements, or supply your own with render.

example.tsx
"use client"import "@/services"import { User, Members } from "@slices.sh/auth/headless"export function Example() {  return (    <User.Root>      <Members.Requests.Row>        <Members.Requests.Approve>Approve</Members.Requests.Approve>        <Members.Requests.Reject>Decline</Members.Requests.Reject>        <Members.Requests.DecisionError />      </Members.Requests.Row>      <Members.Requests.Empty>No pending requests.</Members.Requests.Empty>    </User.Root>  )}

Requires an authenticated account. Organization controls also require organizations and the appropriate role.

API reference

Every public part used by this experience is listed below. Gates render children without adding an element. Element parts accept native element props and render; function children receive the state declared in their props. Scopes provide context rather than a visual element.

Organization.RequestJoin.Rootscope

The host supplies a known organization; this does not expose public discovery.

Props

2 documented props

Organization.RequestJoin.Root props
PropTypeDefault
organizationIdRequired
string—
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Organization.RequestJoin.Root from @slices.sh/auth/headless/organization

Source: @slices.sh/auth/src/headless/organization/request-join/root.tsx

Organization.RequestJoin.Submitaction · <button>

Organization.RequestJoin.Submit renders a button element.

Required scope

RequestJoin.Submit requires RequestJoin.Root.

Props

2 documented props · Native <button> attributes supported

Organization.RequestJoin.Submit props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { pending: boolean }) => ReactNode)—
render

Replace the default element with your own while retaining the part’s behavior and accessibility.

ReactElement—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Organization.RequestJoin.Submit from @slices.sh/auth/headless/organization

Source: @slices.sh/auth/src/headless/organization/request-join/submit.tsx

Organization.RequestJoin.Resultcontent · <p>

Organization.RequestJoin.Result renders a p element.

Required scope

RequestJoin.Result requires RequestJoin.Root.

Props

2 documented props · Native <p> attributes supported

Organization.RequestJoin.Result props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { status: JoinRequest["status"] | null }) => ReactNode)—
render

Replace the default element with your own while retaining the part’s behavior and accessibility.

ReactElement—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Organization.RequestJoin.Result from @slices.sh/auth/headless/organization

Source: @slices.sh/auth/src/headless/organization/request-join/result.tsx

Organization.RequestJoin.Errorcontent · <p>

Organization.RequestJoin.Error renders a p element.

Required scope

RequestJoin.Error requires RequestJoin.Root.

Props

2 documented props · Native <p> attributes supported

Organization.RequestJoin.Error props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { message: string }) => ReactNode)—
render

Replace the default element with your own while retaining the part’s behavior and accessibility.

ReactElement—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Organization.RequestJoin.Error from @slices.sh/auth/headless/organization

Source: @slices.sh/auth/src/headless/organization/request-join/error.tsx

Members.Requests.Accessgate

Members.Requests.Access conditionally renders its children.

Props

1 documented props

Members.Requests.Access props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Members.Requests.Access from @slices.sh/auth/headless/members

Source: @slices.sh/auth/src/headless/members/requests/access.tsx

Members.Requests.Rowcontent · <li>

Members.Requests.Row renders a li element.

Required scope

Requests.Row supplies its own request.

Props

2 documented props · Native <li> attributes supported

Members.Requests.Row props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { request: JoinRequest }) => ReactNode)—
render

Replace the default element with your own while retaining the part’s behavior and accessibility.

ReactElement—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Members.Requests.Row from @slices.sh/auth/headless/members

Source: @slices.sh/auth/src/headless/members/requests/row.tsx

Members.Requests.Approveaction · <button>

Members.Requests.Approve renders a button element.

Required scope

Requests.Approve requires Requests.Row.

Props

2 documented props · Native <button> attributes supported

Members.Requests.Approve props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { pending: boolean }) => ReactNode)—
render

Replace the default element with your own while retaining the part’s behavior and accessibility.

ReactElement—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Members.Requests.Approve from @slices.sh/auth/headless/members

Source: @slices.sh/auth/src/headless/members/requests/approve.tsx

Members.Requests.Rejectaction · <button>

Members.Requests.Reject renders a button element.

Required scope

Requests.Reject requires Requests.Row.

Props

2 documented props · Native <button> attributes supported

Members.Requests.Reject props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { pending: boolean }) => ReactNode)—
render

Replace the default element with your own while retaining the part’s behavior and accessibility.

ReactElement—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Members.Requests.Reject from @slices.sh/auth/headless/members

Source: @slices.sh/auth/src/headless/members/requests/reject.tsx

Members.Requests.DecisionErrorcontent · <p>

Members.Requests.DecisionError renders a p element.

Required scope

Requests.DecisionError requires Requests.Row.

Props

2 documented props · Native <p> attributes supported

Members.Requests.DecisionError props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { message: string }) => ReactNode)—
render

Replace the default element with your own while retaining the part’s behavior and accessibility.

ReactElement—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Members.Requests.DecisionError from @slices.sh/auth/headless/members

Source: @slices.sh/auth/src/headless/members/requests/decision-error.tsx

Members.Requests.Countcontent · <span>

Members.Requests.Count renders a span element.

Props

2 documented props · Native <span> attributes supported

Members.Requests.Count props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { count: number }) => ReactNode)—
render

Replace the default element with your own while retaining the part’s behavior and accessibility.

ReactElement—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Members.Requests.Count from @slices.sh/auth/headless/members

Source: @slices.sh/auth/src/headless/members/requests/count.tsx

Members.Requests.Emptygate

Members.Requests.Empty conditionally renders its children.

Props

1 documented props

Members.Requests.Empty props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Members.Requests.Empty from @slices.sh/auth/headless/members

Source: @slices.sh/auth/src/headless/members/requests/empty.tsx

Members.Requests.Loadinggate

Members.Requests.Loading conditionally renders its children.

Props

1 documented props

Members.Requests.Loading props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Members.Requests.Loading from @slices.sh/auth/headless/members

Source: @slices.sh/auth/src/headless/members/requests/loading.tsx

Members.Requests.Errorcontent · <div>

Members.Requests.Error renders a div element.

Props

2 documented props · Native <div> attributes supported

Members.Requests.Error props
PropTypeDefault
children

Content rendered inside this part.

ReactNode | ((state: { message: string }) => ReactNode)—
render

Replace the default element with your own while retaining the part’s behavior and accessibility.

ReactElement—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Members.Requests.Error from @slices.sh/auth/headless/members

Source: @slices.sh/auth/src/headless/members/requests/error.tsx

Members.Requests.Refreshaction · <button>

Members.Requests.Refresh renders a button element.

Props

2 documented props · Native <button> attributes supported

Members.Requests.Refresh props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—
render

Replace the default element with your own while retaining the part’s behavior and accessibility.

ReactElement—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Members.Requests.Refresh from @slices.sh/auth/headless/members

Source: @slices.sh/auth/src/headless/members/requests/refresh.tsx

User.Rootscope

Says which auth the User parts below read, and whether they may do without it. The parts need no root: left out, they read the nearest auth root's config, or "default", and render nothing without auth. `<User.Root enabled="optional">` is for the one who wants that said in the code.

Props

3 documented props

User.Root props
PropTypeDefault
config

The auth config, a slug from the registry (services/auth/<config>.config.ts). The nearest root's, else "default", when left out.

string—
enabled

Left out or true: required, and missing auth throws. "optional": renders its children and every part inside degrades without auth. false: off. A capability name such as "methods: password": requires auth with it.

Enabled—
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • User.Root from @slices.sh/auth/headless/user
  • User.Root from @slices.sh/auth/headless/passkeys
  • User.Root from @slices.sh/auth/headless/two-factor

Source: @slices.sh/auth/src/headless/user/root.tsx

Organization.Activegate

Item is a <button> repeated once per organization with { active, pending }; clicking makes it active. Personal switches to the personal account. Active renders its children with the active organization in scope, and nothing on the personal account; None is its mirror, once the answer is in. Switcher holds the searchable list: Switcher.Surface maps onto a Popover or a Sheet, Switcher.Options, Input, List, Item, Empty and Error search and list, and Switcher.Shortcuts binds keys to switch.

Capability: organizations

Props

1 documented props

Organization.Active props
PropTypeDefault
children

Content rendered inside this part.

ReactNode—

Required props are marked. A dash means no explicit default is declared in this component.

Alternate public imports
  • Organization.Active from @slices.sh/auth/headless/organization

Source: @slices.sh/auth/src/headless/organization/active.tsx

When something is missing

No service configuration
Install the auth setup below and import "@/services". Required service roots report missing setup; gates do not replace that configuration.
Missing capability or parent scope
Follow each part’s context requirements and the example composition. Capability-aware controls hide when the provider cannot perform their action.
Read the setup guide →