components/checkbox-group.primitive.tsx

themes · packages/radix-ui-themes/src/components/checkbox-group.primitive.tsx · typescript · MIT
ui

Group multiple checkboxes with state management and keyboard navigation.

// Source: https://github.com/radix-ui/themes | License: MIT | Copyright 2023 WorkOS
// Provided via justclaw.it.com; keep this notice with the code.
'use client';

import * as React from 'react';
import { Checkbox as CheckboxPrimitive, Direction } from 'radix-ui';
import {
  Context,
  Primitive,
  useComposedRefs,
  RovingFocus,
  useControllableState,
} from 'radix-ui/internal';

const { useDirection } = Direction;

/* -------------------------------------------------------------------------------------------------
 * CheckboxGroup
 * -----------------------------------------------------------------------------------------------*/
const CHECKBOX_GROUP_NAME = 'CheckboxGroup';

type ScopedProps<P> = P & { __scopeCheckboxGroup?: Context.Scope };
const [createCheckboxGroupContext, createChe

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key