Astryx

Astryx Drawer Header

Component

About

Header for drawers with a title, optional subtitle, close button, and start/end content slots. Same API as DialogHeader. Astryx by Meta. Source: https://astryx.atmeta.com/components/DrawerHeader

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Astryx Drawer Header to your project and fits it to your theme.

Code

How Astryx Drawer Header 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-drawer-header.tsx. */

import '@/components/ui/astryx-drawer-header-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 * as stylex from '@stylexjs/stylex';
import {DrawerHeader} from '@/components/ui/astryx-drawer-header';
import {Layout, LayoutContent, overlayPaddingReset} from '@astryxdesign/core/Layout';
import {Text} from '@astryxdesign/core/Text';

const panelStyle = {
  width: 360,
  maxWidth: '100%',
  boxSizing: 'border-box',
  backgroundColor: 'var(--color-background-card)',
  border: 'var(--border-width) solid var(--color-border)',
  borderRadius: 0,
} as const;

const bodyStyle = {
  padding: 'var(--spacing-4)',
  backgroundColor: 'var(--color-background-muted)',
  borderRadius: 0,
} as const;

function OfficialSample() {
  return (
    // Like the Drawer root, the panel is a padding boundary, so the Layout
    // regions inset by their own --spacing-4 default: the drawer's inset.
    <div {...stylex.props(overlayPaddingReset.reset)} style={panelStyle}>
      <Layout height="auto" header={<DrawerHeader title="Host details" subtitle="web-prod-04" onOpenChange={() => {}} hasDivider />} content={<LayoutContent>
            <div style={bodyStyle}>
              <Text type="body" color="secondary">
                Drawer body content goes here.
              </Text>
            </div>
          </LayoutContent>} />
    </div>
  );
}

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: 360}}>
          <OfficialSample />
        </div>
      </div>
    </Theme>
  );
}

Dependencies

More by Astryx

View all
  • Astryx Banner

    Astryx Banner

    61
  • Astryx Avatar

    Astryx Avatar

    34
  • Astryx Aspect Ratio

    Astryx Aspect Ratio

    32
  • Astryx Badge

    Astryx Badge

    30
  • Astryx Button Group

    Astryx Button Group

    29
  • Astryx Chat Composer Drawer

    Astryx Chat Composer Drawer

    28
  • Astryx Toggle Button

    Astryx Toggle Button

    17
  • Astryx Chat Tokenized Text

    Astryx Chat Tokenized Text

    12