# Palermo Checkbox Group

Provides shared state to a series of checkboxes.

Build a Checkbox Group in this project that looks and behaves like Palermo's. Measured from the running Palermo app (palermo.tryprofound.com). Keep every value exact. Map the tokens onto the project's own theme variables instead of hard-coding them. Use the project's own component library for behaviour, or [Base UI](https://base-ui.com/react/components/checkbox-group) if it has none.

Fidelity: Partly measured from Palermo's Checkbox. No reference has been captured yet.

## Tokens

None.

## CSS

Scoped under `[data-style="palermo"]`; dark rules sit under `[data-theme="dark"]`. The `ui-*` classes and data attributes match the structure below.

```css
[data-style="palermo"] {
  .ui-checkbox-group-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
```

## Structure

How Replicas assembles it on Base UI.

```tsx
import { CheckboxGroup as BaseCheckboxGroup } from "@base-ui/react/checkbox-group";

export function CheckboxGroup({ className, ...props }: Omit<BaseCheckboxGroup.Props, "className"> & { className?: string }) {
  return <BaseCheckboxGroup className={className ? `${"ui-checkbox-group-group"} ${className}` : "ui-checkbox-group-group"} {...props} />;
}
```

## Example

```tsx
import { Checkbox, CheckboxGroup } from "@replicas/ui";
import { useId, useState } from "react";

const events = [
  { value: "shared", label: "Files shared with me" },
  { value: "mentioned", label: "Mentions in comments" },
  { value: "digest", label: "Weekly summary" },
];

const label = { display: "flex", alignItems: "center", gap: 8, color: "var(--text-secondary)" };

export default function CheckboxGroupDemo() {
  const id = useId();
  const [value, setValue] = useState(["shared", "mentioned"]);

  return (
    <CheckboxGroup
      aria-labelledby={id}
      value={value}
      onValueChange={setValue}
      allValues={events.map((event) => event.value)}
    >
      <label id={id} style={{ ...label, color: "var(--text-primary)", fontWeight: "var(--font-weight-medium)" }}>
        <Checkbox parent />
        Email notifications
      </label>
      {events.map((event) => (
        <label key={event.value} style={{ ...label, marginLeft: 22 }}>
          <Checkbox value={event.value} />
          {event.label}
        </label>
      ))}
    </CheckboxGroup>
  );
}
```

## Foundations

The rest of the Palermo style, as a skill: https://replicas.raphaelsalaja.com/skills/palermo/SKILL.md