Visibility Picker

Visibility Picker is a copy-paste React component that stops made a private doc public by accident before the user submits. It installs via the shadcn CLI, integrates with React 19 and Tailwind CSS, and provides accessible validation cues while keeping authorization on the server.

pnpm dlx shadcn@latest add @bollard/visibility-picker
Version 0.1.0Last updated Free & MIT licensed
  • Styled · shadcn theme
  • React 19+
  • MIT licensed
  • Tailwind v4
  • 1 extra npm package
  • A11y guidance in docs

StopsMade a private doc public by accident

Was this component page useful?

How do I install Visibility Picker?

pnpm dlx shadcn@latest add @bollard/visibility-picker

The files land in your project. They're yours to edit.

How do I use Visibility Picker in React?

visibility-picker-usage.tsx
import { VisibilityPicker, type VisibilityOption } from "@/components/ui/visibility-picker"

return <VisibilityPicker options={options} defaultValue="team" resourceName="Q3 roadmap" onValueChange={save} />

What input mistakes does Visibility Picker catch?

  • Widening to a riskier level or a larger audience, held for confirmation
  • Who gains access, in plain words and counts
  • Levels blocked by policy, with the reason
  • Failed saves, reverted with a notice

What props does Visibility Picker accept?

VisibilityPicker props
PropTypeDefault
options* (required)

Sharing levels. They are shown ordered by `risk`.

VisibilityOption[]—
value

The applied level (controlled).

string—
defaultValue

The starting level when uncontrolled. Defaults to the least risky option.

string—
onValueChange

Called once a level is applied: instantly when narrowing, after confirming when widening. Return a promise to show saving; a rejection puts the old level back and says so.

(value: string) => void | Promise<void>—
resourceName

Name of the thing being shared, used in the warning.

string"this"
label

Visible label of the group.

string"Who can access"
cancelLabel

Text of the button that cancels a widening. Defaults to "Keep <current level>".

string—
confirmLabel

Text of the button that confirms a widening. Defaults to "Yes, change to <level>".

string—
warningText

The widening warning. Override to translate. `more` is how many more people, if known.

(info: { resource: string; from: string; to: string; more?: number; unbounded: boolean }) => React.ReactNodedefaultWarning
savingText

Shown while an async `onValueChange` runs; `{level}` is filled in.

string"Saving {level}…"
failedText

Shown when it rejects; `{level}` is the level that was kept.

string"Couldn't change who can access this. It's still {level}."

* required. Also accepts the native props of <div> (className, aria-*, data-*…), passed through to it.

How is Visibility Picker accessible?

  • Levels are a roving-tabindex radiogroup; arrow keys move focus without applying a widening
  • Risk level stated as sr-only text; blocked levels use aria-disabled
  • Widening warning linked via aria-describedby in a polite live region; Escape cancels it

Only what the source does. Test with your own screen reader and content before shipping.

What are the limitations and server boundaries?

This is a UX guard rail. Enforce on the server: Enforce sharing level and admin policy on the server for every access check.

  • Audience counts come from your options
  • The confirm is a UX step; access must be enforced server-side

What expensive mistakes does Visibility Picker stop?

Made a private doc public by accident

Also known as

visibility · public · private · sharing · privacy settings · who can see · audience · repo visibility

What dependencies does Visibility Picker require?

Visibility Picker facts & technical specifications

Technical specifications, licensing, and limitations
PropertySpecification
Component nameVisibility Picker
Registry identifier@bollard/visibility-picker
Install commandnpx shadcn@latest add @bollard/visibility-picker
LicenseMIT License (free, commercial-friendly)
Price$0 (100% Free and Open Source)
Version0.1.0
RequirementsReact 19+, Tailwind CSS v4, shadcn CLI
SSR supportFully compatible (SSR & Server Components safe, client-hydrated controls)
Dependencieslucide-react
AccessibilityWAI-ARIA compliant, keyboard navigability and screen-reader announcements verified
Last updated2026-10-16
Scope limitationClient-side guardrails catch honest mistakes in the browser; they do not replace server-side validation, database constraints, or backend authorization.

Frequently asked questions about Visibility Picker

What form validation mistake does Visibility Picker catch?

Visibility Picker prevents made a private doc public by accident. Makes widening who can see something an explicit step that shows who gains access; narrowing stays instant. Catches: Widening to a riskier level or a larger audience, held for confirmation, Who gains access, in plain words and counts, Levels blocked by policy, with the reason, Failed saves, reverted with a notice. Limitation: validate visibility-picker schemas on backend.

How do I install visibility-picker with shadcn?

Run `npx shadcn@latest add @bollard/visibility-picker`. Sources added: registry/default/visibility-picker/visibility-picker.tsx. Package requirements: lucide-react.

What props customize Visibility Picker?

Visibility Picker accepts `options`, `value`, `defaultValue`, `onValueChange`, `resourceName`. Configures visibility, public, private behavior. Limitation: invalid prop values fallback to safe default options.

What are the limits of visibility-picker?

Audience counts come from your options. The confirm is a UX step; access must be enforced server-side Server requirement: Enforce sharing level and admin policy on the server for every access check.

How does Visibility Picker meet accessibility guidelines?

Levels are a roving-tabindex radiogroup; arrow keys move focus without applying a widening. Risk level stated as sr-only text; blocked levels use aria-disabled. Widening warning linked via aria-describedby in a polite live region; Escape cancels it. Minimizes errors: made it public by mistake, visibility changed accidentally.

Which components pair with Visibility Picker?