Contact section

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

npx shadcn@latest add @silicon-ui/contact-section
Loading…

Installation

With the shadcn CLI

npx shadcn@latest add @silicon-ui/contact-section

Manually

  1. Install the dependencies.

    npm install lucide-react motion
  2. Copy these files into your project. Shared files are skipped if you already have them.

    • components/silicon-ui/blocks/contact-section/contact-section.tsx
    • components/silicon-ui/blocks/contact-section/contact-section.module.css
    • components/silicon-ui/lib/media.ts shared
    • components/silicon-ui/textarea/textarea.tsx shared
    • components/silicon-ui/textarea/textarea.module.css shared
    • components/silicon-ui/segmented-control/segmented-control.tsx shared
    • components/silicon-ui/segmented-control/segmented-control.module.css shared
    • components/silicon-ui/input/input.tsx shared
    • components/silicon-ui/input/input.module.css shared
    • components/silicon-ui/copy-button/copy-button.tsx shared
    • components/silicon-ui/copy-button/copy-button.module.css shared
    • components/silicon-ui/lib/use-copy-feedback.ts shared
    • components/silicon-ui/button/button.tsx shared
    • components/silicon-ui/button/button.module.css shared
    • components/silicon-ui/avatar/avatar.tsx shared
    • components/silicon-ui/avatar/avatar.module.css shared
    • components/silicon-ui/lib/silicon-provider.tsx shared
  3. Install the foundation once per app for the design and motion tokens: npx shadcn@latest add @silicon-ui/silicon-foundation

Usage

Source codetsx
import { ContactSection } from "@/components/silicon-ui/blocks/contact-section/contact-section";

API reference

ContactSection

PropTypeDefault
variant

`form` validates and morphs into a confirmation, `channels` lists ways to reach you, `offices` shows live local times.

ContactSectionVariant

"form""channels""offices"

"form"
titlestring—
descriptionstring—
topics

Topics offered in the form.

string[]["Sales", "Support", "Partnerships", "Press"]
onSubmit

Called with a valid message. Reject to keep the form and show an error; resolve to show the confirmation.

(message: ContactMessage) => void | Promise<void>—
channelsContactChannel[]contactExampleChannels
channel

Selected channel (controlled).

string—
defaultChannelstring—
onChannelChange(value: string) => void—
officesContactOffice[]contactExampleOffices
classNamestring—

Also accepts the props of HTMLAttributes.

ContactSectionBlock

PropTypeDefault
variantContactSectionVariant

"form""channels""offices"

"form"

Dependencies

npm
lucide-reactmotion
Registry
silicon-motion-tokensavatarbuttoncopy-buttoninputsegmented-controltextarea