About
Standalone label group for one control or a caller-labelled group, with optional supporting text, optionality indicators, icon, and tooltip. Astryx by Meta. Source: https://astryx.atmeta.com/components/FieldLabel
Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Field Label to your project and fits it to your theme.
Code
How Astryx Field Label 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-field-label.tsx. */
import '@/components/ui/astryx-field-label-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 {FieldLabel} from '@/components/ui/astryx-field-label';
import {VStack} from '@astryxdesign/core/Layout';
const LockIcon = (props: React.SVGProps<SVGSVGElement>) => (
<svg
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={1.5}
strokeLinecap="round"
strokeLinejoin="round"
{...props}>
<rect x="3" y="11" width="18" height="11" rx="2" />
<path d="M7 11V7a5 5 0 0 1 10 0v4" />
</svg>
);
function OfficialSample() {
return (
<VStack gap={4}>
<FieldLabel label="Email address" inputID="email-input" isRequired />
<FieldLabel
label="Phone number"
inputID="phone-input"
isOptional
description="Include country code for international numbers"
/>
<FieldLabel
label="API key"
inputID="api-input"
labelTooltip="Your API key can be found in the developer settings"
labelIcon={LockIcon}
/>
<FieldLabel label="Disabled field" inputID="disabled-input" isDisabled />
</VStack>
);
}
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: 280}}>
<OfficialSample />
</div>
</div>
</Theme>
);
}















