Molecule
FormActions
Requiere <UIProvider> — Primeros pasos →
Instalación
Instala solo este componente (copia el código fuente a tu proyecto, sin dependencia npm)
npx orn-ui add form-actionsO instala el paquete completo e impórtalo
pnpm add orn-ui
import { FormActions } from 'orn-ui/form-actions';Uso
- cuándo usarlo — La barra de acciones al pie de un formulario o un modal — mantiene el orden y el espaciado parejos.
- primaryLabel — Si se omite, solo se renderiza el botón secundario (un pie con Cancelar únicamente).
- primaryLoading / primaryDisabled — `primaryLoading` mientras corre el envío, `primaryDisabled` mientras el formulario no es válido.
Clip del demo todavía sin grabar — ver MEDIA.md
Variantes
Primary + secondary
<FormActions primaryLabel="Save" onPrimaryPress={() => {}} onSecondaryPress={() => {}} />Secondary only
<FormActions secondaryLabel="Close" onSecondaryPress={() => {}} />Primary disabled
<FormActions primaryLabel="Save" onPrimaryPress={() => {}} primaryDisabled onSecondaryPress={() => {}} />Primary loading
<FormActions primaryLabel="Saving..." onPrimaryPress={() => {}} primaryLoading onSecondaryPress={() => {}} />Código completo del demo
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> | — | — |