# Integration settings

One connected service in its own surface: its mark, name, count and connection state, the fields that service needs, a key it never shows, and one explicit Save and Discard.

Live variants: https://design.arcadia.is/components/integration-settings

```tsx
import { IntegrationSettings } from "@arcadia/ui";
```

```tsx
import { useState } from "react";
import { Icon, Card, IntegrationSettings } from "@arcadia/ui";

function Service() {
  const [on, setOn] = useState(true);
  return (
    <div {...stylex.props(styles.frame)}>
      <Card variant="inset">
        <IntegrationSettings
          name="Linear"
          logo={<Icon name="plugins" />}
          count={12}
          countLabel="tool"
          meta="Connected to the Design workspace"
          pausedMeta="Paused on Nov 20"
          enabled={on}
          onToggle={setOn}
          authSummary="ada@example.com"
          permissionsSummary="Read and write issues, comments and projects"
        />
      </Card>
    </div>
  );
}
```

## Accessibility

The switch is the platform's checkbox drawn as a switch, named with the service and its state, so Space toggles it and a form and a reader see a real state.

Each label names its control: the text input, the picker's trigger button and the toggle. The secret's group is named by the field's label, and its replacement field by `Replace API key`, or `New API key` when none is stored. A secret's hint describes the group alone, so it is read once when the group is reached; the replacement field carries no second copy of it. An error is in the control's aria-describedby, and a save that fails moves focus to the first invalid control.

A stored secret is never in the DOM. Generating a key sets a polite status line to `New key generated`, and the key stands outside it, shown once, with a copy action that names it. The picker is the kit's menu: arrows move, Enter chooses, Escape closes it and returns focus to the trigger.

## API reference

### IntegrationSettings

- `name` (`string`, required): The service's name.
- `logo` (`ReactNode`): The service's own mark, in a tile beside the name.
- `count` (`number`): A count beside the name: the tools it offers, the accounts it holds.
- `countLabel` (`string`): What the count counts, for a reader who hears it ("tool" reads "12 tools").
- `meta` (`string`): One quiet line under the name: the account, the address, the connection.
- `pausedMeta` (`string`, default `"Paused"`): The line under the name while the service is off.
- `enabled` (`boolean`): Controlled on state.
- `defaultEnabled` (`boolean`, default `true`): The state it starts at when uncontrolled. Default true: a connected service is on until someone pauses it.
- `onToggle` (`(enabled: boolean, details: { event: Event }) => void`): Called with the new state when the switch toggles.
- `authSummary` (`ReactNode`): Read-only: who authorised the connection.
- `permissionsSummary` (`ReactNode`): Read-only: what the connection may reach.
- `fields` (`readonly IntegrationField[]`, default `[]`): The fields this service needs, in the order a person meets them.
- `values` (`IntegrationValues`): The values the fields start at, by key: a field's own defaultValue stands where its key is absent.
- `onSave` (`(values: IntegrationValues, dirtyFields: readonly string[]) => void | Promise<void>`): Called with the fields' values and the keys that changed. A write-only secret appears only when it was replaced, generated or cleared (""), so saving another field never sends or erases a stored key. A rejection is shown in the actions bar and changed nothing.
- `onDiscard` (`() => void`): Called after Discard put every field back.
- `saveLabel` (`string`, default `"Save"`): The save action's words.
- `discardLabel` (`string`, default `"Discard"`): The discard action's words.
- `rootStyle` (`IntegrationSettingsStyle`): Typed StyleX override: where the surface sits and its knobs.
