Xzero UI
Pro library

Contact section

A validated contact form that morphs into a confirmation, support channels, and office cards with local times.

$ pnpm dlx shadcn@4.23.0 add @xzero-ui/contact-section
Live · keyboard ready

Use this as a starting point and replace the sample data with your own.

When to use

When not to use

Installation

Register both Xzero UI namespaces in your project's components.json:

{
  "registries": {
    "@xzero-ui": "https://mcp.xzero.co.uk/r/{name}.json",
    "@xzero-ui-pro": "https://mcp.xzero.co.uk/r/pro/{name}.json"
  }
}
npx shadcn@4.23.0 add @xzero-ui/contact-section

Install xzero-foundation once, and import @/components/xzero/foundation.css in your app root. No Xzero token is used by this snapshot. For sample portraits, photos, fonts, or logos, download https://mcp.xzero.co.uk/install-assets.mjs and run node xzero-install-assets.mjs <receiving-project>.

Usage

import { ContactSection } from "@/components/xzero/blocks/contact-section/contact-section";

export function Contact() {
  return (
    <ContactSection
      title="Talk to us"
      topics={["Sales", "Support"]}
      onSubmit={async message => {
        const response = await fetch("/api/contact", { method: "POST", body: JSON.stringify(message) });
        if (!response.ok) throw new Error("Could not send");
      }}
    />
  );
}

API reference

ContactSection

A contact section in three layouts: a validated form that springs into a confirmation, a list of channels with detail, or offices with live local times and open status.

PropTypeDefaultDescription
variant"form" | "channels" | "offices""form"Layout.
titlestring–Section heading.
descriptionstring–One line under the heading.
topicsstring[]["Sales", "Support", "Partnerships", "Press"]Topics offered in the form as a radio group of chips.
onSubmit(message: { name; email; topic; message }) => void | Promise<void>–Called with a valid message. Reject to keep the form and show an error; resolve to show the confirmation.
channels{ value; label; meta; icon?; detail: ReactNode }[]contactExampleChannelsWays to reach you for the channels variant.
channelstring–Selected channel (controlled).
defaultChannelstring–Initial channel when uncontrolled.
onChannelChange(value: string) => void–Called when the channel changes.
offices{ city; timeZone; address: string[]; email?; hours?: [number, number] }[]contactExampleOfficesOffices. timeZone is an IANA zone; hours default to 9 to 18 local time.
classNamestring–Extra class on the section.

ContactSectionBlock

Default export: a preview with a layout switcher. Messages are simulated and never sent.

PropTypeDefaultDescription
variantContactSectionVariant"form"Initial variant.

Keyboard interactions

KeysAction
Arrow keysMove between topic chips, which form a radio group.

Accessibility

Motion

Responsive behavior

Performance

Notes for AI

Guidance for AI tools

Blocks are complete, self-contained screens with sample data. Replace the sample data and connect the callbacks described above. Follow the declared prop types and do not invent props. Keep keyboard access, reduced motion support, and both light and dark themes intact when adapting it.

Full library index: https://ui.xzero.co.uk/llms.txt

Browse all components