> For AI agents: the complete documentation index is available at https://rickyshin93.github.io/tao-ui/llms.txt, the full documentation bundle is available at https://rickyshin93.github.io/tao-ui/llms-full.txt.

# FormActions

Data Entry`@rockshin/tao-ui`

[Examples](#examples)[API](#api)

Lays out submit, cancel, and secondary actions for forms.

## When to use

Use FormActions at the end of a form or section to align the final actions consistently.

**Recommended**

- Keep action order consistent across forms.
- Use a single submit action unless the workflow truly branches.

**Avoid**

- Do not use the component outside its intended interaction model.

## Examples


### Basic usage
```tsx preview
import { Button, FormActions } from '@rockshin/tao-ui';

function FormActionsExample() {
  return (
    <FormActions>
      <Button variant="ghost">Cancel</Button>
      <Button>Save changes</Button>
    </FormActions>
  );
}

export default FormActionsExample;
```

### Secondary and destructive actions
```tsx preview
import { Button, FormActions } from '@rockshin/tao-ui';

function FormActionVariants() {
  return (
    <FormActions>
      <Button variant="destructive">Delete</Button>
      <Button variant="ghost">Cancel</Button>
      <Button>Save</Button>
    </FormActions>
  );
}

export default FormActionVariants;
```

### Semantic alignment
```tsx preview
import { Button, FormActions } from '@rockshin/tao-ui';

function CustomizedFormActions() {
  return (
    <FormActions styles={{ root: { justifyContent: 'space-between' } }}>
      <Button variant="ghost">Back</Button>
      <Button>Continue</Button>
    </FormActions>
  );
}

export default CustomizedFormActions;
```

### Complete form composition
Compose layout, fields, and actions with native submission feedback.
```tsx preview
import { useState } from 'react';
import {
  FormLayout,
  FormSection,
  FormField,
  FormActions,
  Input,
  Textarea,
  Button,
} from '@rockshin/tao-ui';
export default function Example() {
  const [saved, setSaved] = useState('');
  return (
    <form
      onSubmit={(e) => {
        e.preventDefault();
        setSaved(String(new FormData(e.currentTarget).get('name')));
      }}
      onReset={() => setSaved('')}
    >
      <FormLayout>
        <FormSection title="Profile" description="Public workspace information">
          <FormField label="Display name" required>
            <Input name="name" required defaultValue="Alex" />
          </FormField>
          <FormField label="Bio" description="A short introduction">
            <Textarea name="bio" autoSize />
          </FormField>
        </FormSection>
        <FormActions>
          <Button type="reset">Reset</Button>
          <Button type="submit" variant="primary">
            Save
          </Button>
        </FormActions>
        <output aria-live="polite">
          {saved ? `Saved ${saved}` : 'No changes saved'}
        </output>
      </FormLayout>
    </form>
  );
}
```

### Alignment and wrapping
Set root alignment while retaining wrapping on narrow screens.
```tsx preview
import { FormActions, Button } from '@rockshin/tao-ui';
export default function Example() {
  return (
    <FormActions
      styles={{ root: { justifyContent: 'space-between', flexWrap: 'wrap' } }}
    >
      <Button>Back</Button>
      <Button variant="primary">Continue</Button>
    </FormActions>
  );
}
```

### Pending actions
Disable form actions while pending and show loading; a separate control finishes this local demo.
```tsx preview
import { useState } from 'react';
import { FormActions, Button, Stack } from '@rockshin/tao-ui';
export default function Example() {
  const [pending, setPending] = useState(false);
  return (
    <Stack direction="vertical">
      <FormActions>
        <Button disabled={pending}>Cancel</Button>
        <Button loading={pending} onClick={() => setPending(true)}>
          Save
        </Button>
      </FormActions>
      {pending && (
        <Button onClick={() => setPending(false)}>
          Finish simulated request
        </Button>
      )}
    </Stack>
  );
}
```

## API


### [#](#formactions)FormActions



| Property | Description | Type | Default Value |
| --- | --- | --- | --- |
| className | Additional css class | `string | undefined` | `-` |
| style | Additional style | `CSSProperties | undefined` | `-` |

