Labeled Separator
nswds-ui/labeled-separatorFreeComponent
A horizontal divider broken by a centred label, such as an "or" rule between sign-in methods.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/digitalnsw/nswds-ui/main/apps/registry/public/r/labeled-separator.jsonSource
1import type * as React from 'react'23import { Separator } from '@/components/separator'4import { cn } from '@/lib/utils'56/**7 * A horizontal divider broken by a centred label — e.g. the "or" rule that8 * separates one sign-in method from another in a login form.9 *10 * Always renders a label (defaulting to "or"); it is not a plain horizontal11 * rule. For an unbroken divider, use the `Separator` component instead.12 *13 * The two flanking rules are rendered `decorative` (role="none") because the14 * visible label already conveys the boundary to assistive tech; exposing two15 * `role="separator"` elements either side of it would be redundant noise.16 */17function LabeledSeparator({18 className,19 children = 'or',20 ref,21 ...props22}: React.ComponentProps<'div'> & { children?: React.ReactNode }) {23 return (24 <div25 ref={ref}26 data-slot='labeled-separator'27 className={cn('flex items-center gap-3', className)}28 {...props}29 >30 <Separator decorative className='flex-1' />31 <span32 data-slot='labeled-separator-content'33 className='shrink-0 text-sm text-muted-foreground'34 >35 {children}36 </span>37 <Separator decorative className='flex-1' />38 </div>39 )40}4142export { LabeledSeparator }4344export type LabeledSeparatorProps = React.ComponentProps<typeof LabeledSeparator>
What it pulls in
npm packages
Other registry items
Files it writes
More from @nswds/ui
All 46 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Aspect Ratioaspect-ratio | @nswds/ui | Components | Free | 2 deps · 2 files | |
| Badgebadge | @nswds/ui | Components | Free | 4 deps · 2 files | |
| Buttonbutton | @nswds/ui | Components | Free | 4 deps · 2 files | |
| Cardcard | @nswds/ui | Components | Free | 2 deps · 2 files | |
| Collapsiblecollapsible | @nswds/ui | Components | Free | 1 dep | |
| Drawerdrawer | @nswds/ui | Components | Free | 3 deps · 2 files | |
| Expandable Searchexpandable-search | @nswds/ui | Components | Free | 3 deps · 2 files | |
| Fieldfield | @nswds/ui | Components | Free | 4 deps · 2 files |
