# FormActions

> Molecule — orn-ui

> ⚠️ Requiere <UIProvider>: Este componente (como todos los de orn-ui) debe renderizarse dentro de un ancestro <UIProvider>, o lanza un error en runtime. See https://orn-ui-docs.vercel.app/getting-started.md

> Corre en Expo SDK 54, 55, 56 y 57, y en React Native puro >=0.81 con react >=19.1. Sin módulos nativos — funciona en Expo Go, sin prebuild.

## Instalación

Instala solo este componente (copia el código fuente a tu proyecto, sin dependencia npm)
```bash
npx orn-ui add form-actions
```

O instala el paquete completo e impórtalo
```tsx
pnpm add orn-ui
import { FormActions } from 'orn-ui/form-actions';
```

Depende de: core (theme + icons), button

## Variantes

### Primary + secondary

```tsx
<FormActions primaryLabel="Save" onPrimaryPress={() => {}} onSecondaryPress={() => {}} />
```

### Secondary only

```tsx
<FormActions secondaryLabel="Close" onSecondaryPress={() => {}} />
```

### Primary disabled

```tsx
<FormActions primaryLabel="Save" onPrimaryPress={() => {}} primaryDisabled onSecondaryPress={() => {}} />
```

### Primary loading

```tsx
<FormActions primaryLabel="Saving..." onPrimaryPress={() => {}} primaryLoading onSecondaryPress={() => {}} />
```

## Código completo del demo

```tsx
const variants: VariantDef[] = [
  { label: 'Primary + secondary', content: <FormActions primaryLabel="Save" onPrimaryPress={() => {}} onSecondaryPress={() => {}} /> },
  { label: 'Secondary only', content: <FormActions secondaryLabel="Close" onSecondaryPress={() => {}} /> },
  {
    label: 'Primary disabled',
    content: <FormActions primaryLabel="Save" onPrimaryPress={() => {}} primaryDisabled onSecondaryPress={() => {}} />,
  },
  {
    label: 'Primary loading',
    content: <FormActions primaryLabel="Saving..." onPrimaryPress={() => {}} primaryLoading onSecondaryPress={() => {}} />,
  },
];
return <VariantList variants={variants} />;
```

## Props

| Nombre | Tipo | Por defecto | Descripción |
|---|---|---|---|
| `primaryLabel?` | `string` | — | Si se omite, solo se muestra el botón secundario. |
| `onPrimaryPress?` | `() => void` | — | — |
| `primaryDisabled?` | `boolean` | false | — |
| `primaryLoading?` | `boolean` | false | — |
| `primaryLeftIconName?` | `IconName` | — | — |
| `secondaryLabel?` | `string` | — | — |
| `onSecondaryPress` | `() => void` | — | — |
| `style?` | `StyleProp<ViewStyle>` | — | — |
