About
A layout container that arranges form fields with consistent spacing and direction. FormLayout handles where fields go, not state or submission. Wrap it in a native <form> for that; <form> has no Astryx replacement, so it stays a plain element. Supports vertical (default), horizontal, and horizontal-labels directions, and can be nested to mix them. Astryx by Meta. Source: https://astryx.atmeta.com/components/FormLayout
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Form Layout to your project and fits it to your theme.
Code
How Astryx Form Layout is used: the demo's code. The component's own source comes with a free account.
Usage.tsx
'use client';
/* Copyright (c) 2026 Meta Platforms, Inc. See the MIT notice in astryx-form-layout.tsx. */
import '@/components/ui/astryx-form-layout-utils/astryx-preview.css';
import '@astryxdesign/theme-neutral/fonts.css';
import {useSyncExternalStore} from 'react';
import {Theme} from '@astryxdesign/core/theme';
import {neutralTheme} from '@astryxdesign/theme-neutral/built';
import {useState} from 'react';
import {FormLayout} from '@/components/ui/astryx-form-layout';
import {TextInput} from '@astryxdesign/core/TextInput';
function OfficialSample() {
const [first, setFirst] = useState('Priya');
const [last, setLast] = useState('Sharma');
const [email, setEmail] = useState('priya.sharma@example.com');
const [city, setCity] = useState('San Francisco');
const [state, setState] = useState('CA');
const [zip, setZip] = useState('94105');
return (
<FormLayout style={{width: '100%', minWidth: 0}}>
<FormLayout direction="horizontal">
<TextInput label="First Name" value={first} onChange={setFirst} />
<TextInput label="Last Name" value={last} onChange={setLast} />
</FormLayout>
<TextInput label="Email" value={email} onChange={setEmail} />
<FormLayout direction="horizontal">
<TextInput label="City" value={city} onChange={setCity} />
<TextInput label="State" value={state} onChange={setState} />
<TextInput label="ZIP" value={zip} onChange={setZip} />
</FormLayout>
</FormLayout>
);
}
function readPreviewMode() {
const {classList} = document.documentElement;
return classList.contains('dark') ? 'dark' : 'light';
}
function subscribeToPreviewMode(callback: () => void) {
const observer = new MutationObserver(callback);
observer.observe(document.documentElement, {attributes: true, attributeFilter: ['class']});
return () => observer.disconnect();
}
export default function Demo() {
const mode = useSyncExternalStore(subscribeToPreviewMode, readPreviewMode, () => 'light' as const);
return (
<Theme theme={neutralTheme} mode={mode}>
<div className="astryx-demo">
<div className="astryx-demo-content" data-centered style={{maxWidth: 520}}>
<OfficialSample />
</div>
</div>
</Theme>
);
}















