Your next page is taking shape...

Opening Your Next Page…

Loading the guide and preparing its examples for you to explore. The page will appear here automatically when it’s ready, so you can keep this view open without refreshing.

Made for Preact. Built to be yours.

Form Block

A two column signup page with a cover image. Connect the form's onSubmit callback to your account service, then adapt the fields, branding and legal links. Account Creation Stays in Your App; the block provides the registration interface. Explore validation and submission feedback in the live demo, then use the source and setup steps to integrate your onboarding flow.


Interactive Live Preview
Try it. Make it yours.

Variant 2 of 5

Live Preview and Source

Open
Setting the scene...

Interactive preview

Add This Block

Copy this variant into your Preact project, install the dependencies you are missing and connect your own authentication service. The source stays local, so you can change its layout without introducing another application framework.

  1. Copy the Block

    Open the Showcase’s Code Tab and copy the files below relative to src/components/blocks. Keep the source folder structure so relative imports resolve. These are destination paths; the Code tab’s display labels such as app/signup/page.tsx are not the installation paths. The examples below assume your importing file is src/App.tsx.

    Text ReferencePlain Text
    signup/signup-02/page.tsx
    signup/signup-02/signup-form.tsx
    auth/shared/auth-utils.ts
    auth/shared/google-icon.tsx
    shared/branding/kamod-brand-link.tsx
    shared/branding/kamod-brand-sizes.ts
    shared/branding/kamod-logo.tsx
    shared/branding/kamod-logo-url.ts
    shared/branding/kamod-logo-horizontal.svg
    shared/branding/kamod-logo-horizontal-dark.svg
    auth/shared/auth-cover-url.ts
    auth/shared/auth-cover.svg
    Keep supporting files together

    Forms use shared validation and provider helpers. Branded and illustrated layouts also need their listed SVGs and URL helpers. Keep ?url imports in a Vite app, or adapt them to your bundler. If TypeScript cannot resolve an SVG import, include Vite’s client types (for example, import "vite/client" in an existing declaration file). Keep the repository’s license with your copied source.

  2. Install Missing Dependencies

    Install only what your app does not already have. Preact renders the block, Kamod UI provides its interactive components, and Icons supplies its icons. Themes and Signals support the shared Kamod setup.

    Install PackagesTerminal
    pnpm add @kamod-ch/ui @kamod-ch/icons preact @kamod-ch/themes @preact/signals
  3. Set Up Styles and Import

    Follow the Theme and Tailwind Setup. Import your global stylesheet and make sure Tailwind scans the copied source and Kamod components. Keep your existing setup if the app already uses Kamod.

    Import SetupTypeScript
    import { Signup02 } from "./components/blocks/signup/signup-02/page";
    Import from your local source

    The @kamod-ch/blocks/signup/signup-02 path identifies source in this repository; the blocks package is private. Use the local import above rather than trying to install that path as a published package.

    Check the First Render

    The form controls, borders and page background should follow your app’s theme. If the layout appears unstyled, check the global CSS import and Tailwind source detection before changing the block’s classes. If an import fails, first compare your folder paths with the copy list; renaming only one file can break its relative imports.

Usage

Start by rendering the supplied page to check its appearance, then connect its local form to your application. Signup02 takes No Props; callbacks belong to SignupForm inside the copied page. The form owns its input and feedback state, while your app owns the authenticated session and destination after success.

Render the Page or Form

Usage PatternTypeScript
import { Signup02 } from "./components/blocks/signup/signup-02/page";

export const App = () => <Signup02 />;

This renders a complete page with its own main landmark. To preserve this variant’s layout, edit the SignupForm call in your copied page.tsx. To embed the form in an existing page or dialog, import the form directly instead of nesting another full page. Its heading is an h1; adjust that level and the field IDs if your host page already has a heading or another instance of this form.

Connect Your Authentication Service

The example below wraps the form in a component that receives your service functions. Pass the same callbacks to the form in page.tsx if you keep the original layout. The imported value types describe the submitted payload; they are not configuration props on Signup02. See Form Props for each callback and link destination.

Usage PatternTypeScript
import { SignupForm } from "./components/blocks/signup/signup-02/signup-form";
import type { SignupValues } from "./components/blocks/auth/shared/auth-utils";

type Props = {
  submit: (values: SignupValues) => Promise<void>;
};

// These functions come from your application's authentication service.
export const AccountForm = ({ submit }: Props) => (
  <SignupForm
    onSubmit={submit}
    loginHref="/login"
    termsHref="/terms"
    privacyHref="/privacy"
  />
);
Report the actual result
Return the request’s promise so loading lasts until it settles. If your service resolves with an error result rather than rejecting, handle that result explicitly; the form otherwise treats completion as success. Map useful messages to the local error/status state in signup-form.tsx. A callback’s return value does not automatically populate field errors or navigate to another page.
Replace the demo before connecting users
Remove sleep(), demoRejects() and the simulated success/error messages. Without a callback, the demo can still report success. Supply real account links and implement your success destination; the block does not create a session or redirect on its own.

Check the Complete Flow

  • Invalid and Valid Submissions. Check the first invalid field receives focus, correct its input, then verify a successful request and a rejected request. Local field errors are recomputed on submission, not cleared as each character is typed.
  • Pending Requests. Buttons disable while loading, but inputs remain editable. Decide whether your app should freeze those fields and prevent repeated submit events; a disabled button alone is not a complete request guard. Handle cancellation if the form can unmount while a request is pending.
  • Alternative Paths. Test every visible provider button and account link. Social signup bypasses the email form’s terms and field checks; apply any required consent step in that flow too.
Finish the integration

The Variant Details explain this form’s payload and provider behavior. Finish with the Accessibility Checks using your real labels, errors and service responses.

Props and Data

Signup02 is a ready-made demonstration page with no public props. The reference below describes the Local Form you can configure after copying the source. Definitions come directly from the implementation; descriptions explain where your application takes over. Start with the component or data shape you want to change, then follow its type link to the complete definition.

API reference
Your API, from source

The signatures below come from the copied source files. Use the Data Type Reference to inspect complete definitions and required fields. Optional callbacks do not imply that a backend is included. Select a table row’s type name to open its definition automatically. Use import type from the corresponding copied file when typing your own data or component inputs. This reference describes the shipped source; changes in your local files will not update this page.

Form Props

Each field includes its type and integration behavior. The asterisk
marks required fields. Omitted optional fields use the defaults described below. The definitions retain the actual source’s optional markers and callback return types. Read each field together with its owning type: the same name can have a different purpose on another helper. A ? means the field may be omitted, not that every optional field has a fallback value. When a field accepts an array, its required marker means you must supply the array; check the helper’s behavior before using an empty [].
Local helper props and data fields
Prop / typeDescription
onSubmit
(values: SignupValues) => void | Promise<void>SignupFormProps
Receives name, email and password after the local field checks and terms acceptance pass. Return a promise so the form awaits account creation; thrown errors or rejections reach its error state. The copied form still runs its artificial delay and error-address check first and shows demo success even without a callback. Replace those behaviors and messages, and add any consent record your service requires because SignupValues does not contain the checkbox state.
onSocialSignup
(provider: AuthProvider) => void | Promise<void>SignupFormProps
Called with github or google from the provider buttons when showSocial is enabled. This path is separate from the email form’s field and terms validation; a returned promise is awaited and failures use the social error state. Connect your provider registration flow and any consent requirements in your app. Without this callback the demo can still show success, and the AuthProvider union alone does not add a GitLab button.
loginHref
stringSignupFormProps
URL for the Log in link below the signup form; defaults to #. Set it to the existing-account sign-in route appropriate for your application. The link does not submit the signup form or transfer its entered values. Use your router’s link component in the copied source if navigation must stay within a client-side router.
termsHref
stringSignupFormProps
Destination for the Terms of Service link beside the signup consent checkbox; defaults to #. Link to the terms that apply to your product and keep that content available to users before they submit. The email form requires the checkbox locally, but this URL does not record acceptance and the SignupValues payload does not include it. Add any required consent data to your own submission flow.
privacyHref
stringSignupFormProps
Destination for the Privacy Policy link in the signup form’s consent text; defaults to #. Supply the actual policy page for your product rather than leaving the demo anchor in place. This is a navigation prop only: it does not fetch policy content, track which version was read or add consent information to the submitted values.
showSocial
booleanSignupFormProps
Shows the GitHub and Google signup buttons and their separator above the email fields. It defaults to false on SignupForm, while the supplied Signup05 page explicitly enables it. Enabling the controls does not configure providers; supply onSocialSignup and connect the corresponding flow. The email form remains available, and hiding the social controls does not alter its validation.
name
stringSignupValues
Name entered by the user and passed to the signup callback. Local validation requires at least two characters after trimming for the check, but the submitted value itself is not trimmed. Decide how your service normalizes and stores display names. This payload contains only name, email and password; the separately managed terms checkbox is not included.
email
stringSignupValues
Email string passed to your submit callback after the form’s simple local format check. The copied form forwards the entered value without normalizing it; decide how your service handles surrounding whitespace and address casing. Passing the local check neither verifies ownership nor proves that an account exists. The demo also treats addresses containing error as a simulated failure before invoking onSubmit.
password
stringSignupValues
Password string entered in the form and forwarded to onSubmit after the local minimum-length check of eight characters. The field does not trim or hash the value, and the demo’s validation is not an authentication service. Apply your application’s actual credential rules and submit through the appropriate service; avoid placing this value in logs or URLs. It is never included in the email-only MagicLinkValues payload.

Data Type Reference

Expand a definition to copy its exact TypeScript shape. Required fields are listed below each summary for fields declared in that definition. The code header shows the file's installation path; copy the definition with the button beside it. For intersections, also inspect the referenced base type’s required fields. Local types can be imported from the same files as your copied components; they are not added to the zero-prop page wrapper.

Complete Form Signature

6 declared fields
SignupFormProps
The local form accepts optional callbacks and destination links. The exported page wrapper takes no props and does not forward these callbacks. Inspect the Complete Definition of SignupFormProps before adapting it.

Submission Values

3 declared fields
SignupValues
Passed to onSubmit after local validation. Terms acceptance is kept separately and is not included in this payload. Inspect the Complete Definition of SignupValues before adapting it.
Required fields
name, email, password

Social Provider

Declaration
AuthProvider
The shared union includes gitlab, but the current forms render only GitHub and Google buttons. Adding another provider requires adding its UI and handler. Inspect the Complete Definition of AuthProvider before adapting it.

Registration and Consent

Registration validates a name, email and password, and asks the user to accept the terms. This combines field feedback with an explicit consent step; it does not create an account or store legal acceptance by itself.

Consent is separate from the payload
The checkbox is validated locally, but SignupValues contains only name, email and password. Extend your copied form and service contract if you need to persist consent, policy version or acceptance time.
Social providers need a service
The form defaults to hiding social buttons; this page does not enable them. Pass showSocial and onSocialSignup to show and connect GitHub and Google. That provider path does not run the email form’s field or terms checks, so handle any required consent in the provider flow as well.
Usage PatternTypeScript
<SignupForm
  showSocial
  onSocialSignup={startProviderSignup}
  onSubmit={createAccount}
/>
Connect your service

The callback names above represent functions supplied by your app. Keep server-side validation and credential handling in your authentication service. Adapt the form’s demo messages to that service’s actual result.

About This Block

The page provides the setting; the form owns the interaction. This composition combines Input, Label, Button and Alert into a complete registration interface. Your application supplies the authentication service and real destinations; a successful preview interaction does not create a session.

Composition and Customization

Edit page.tsx for centering, surfaces, branding and any cover image. Edit signup-form.tsx for fields and submission. The full-page wrapper takes no configuration props; pass callbacks to SignupForm inside that page. See Render the Page or Form for both entry points.

Shared auth/shared helpers supply validation and provider artwork; optional branding lives in shared/branding. Keep imported helpers when reusing the form elsewhere. Its values are local component state: there is no public value or initialValues prop. To add a field or prefill values, update state, validation and the payload type together.

Consent and account data are separate. The local terms check is not included in SignupValues, whose fields are name, email and password. If your app records acceptance, extend the copied form and service payload deliberately.

This line in the Submission Handler is the handoff to your application, after local validation:

Usage PatternTypeScript
await onSubmit?.(values);

The optional callback means the demo can show success without a connected service. A rejected promise enters the form’s error state; a resolved error object does not do so automatically. Follow Connect Your Authentication Service to map your service’s result and replace the demo messages.

Responsive Behavior

A two-column page pairs a constrained form with a cover image. The lg:grid-cols-2 layout starts at 1024px; below it, the image is hidden and the form keeps the available width. Branding remains above the form.

Let the page grow when feedback appears. The full-page wrappers use min-h-svh, not a fixed content height. Keep labels, legal links and errors able to wrap, and test with the on-screen keyboard open. When embedding the form in a Dialog, preserve its scroll area and keep the submit button reachable.

Pair bg-background with text-foreground and card surfaces with their matching foreground token. The block theming guide explains how to keep fields, errors and loading states legible in both modes. Review replacement images at each breakpoint; decorative art should not carry instructions or duplicate the form’s text alternative.

Accessibility

Preserve the field’s complete identity
Keep the Label associated with its control’s id, retain aria-invalid and link help/errors through aria-describedby. A placeholder is secondary guidance, not a label. If you render two instances, give labels, inputs and messages distinct ID prefixes.
Make failure recoverable
Local validation calls focusFirstError before sending data. Include new inputs in that logic and keep messages beside the field they explain. Server failures need a clear retry path without exposing sensitive account details; review the input accessibility guidance when extending feedback.
Keep pending and completion states connected
loading disables submission controls, while role="status" and aria-live="polite" announce messages. Preserve these cues when changing button copy. If the next step navigates away, your application should also manage focus in the destination page.
Check the full flow

Invalid input → correction → pending request → success or a recoverable failure. Repeat at 320px, 768px, 1024px and 1440px, with keyboard-only input, 200% zoom and both color modes. Use Check the Complete Flow for the integration checklist.

Replace the Demo Behavior

Replace simulation before connecting real users. Remove sleep()and demoRejects(), rewrite the success/error messages and provide real account and legal URLs. Check Form Props for the destinations this variant exposes. Branded layouts also need a real home destination on KamodBrandLink, whose fallback is #.

If enabling showSocial, connect onSocialSignup and handle any required consent in that provider flow too. Provider buttons do not run the email form’s field or terms checks. The variant behavior notes explain these callback boundaries.

Keep server validation, sessions and recovery in your application’s service layer. Reuse the form’s visual structure while adapting its messages and next steps to your actual product. Finish with the whole-journey review, including a slow request and a failed one.

Source and Customization

Use the Checked-in Kamod Implementation as your reference when adapting this variant. The Showcase’s Code Tab includes its supporting files, and the Setup Instructions explain where to place them and how to keep their imports intact. Before changing a helper, trace where it is used in the composition and check its inputs in the Props and Data Reference. This helps you adapt one part of the block without overlooking the files or behavior it depends on.

Keep your local copy focused on the layout and interactions your app actually uses. Start with the data and content, then adjust composition and styling using the same semantic theme tokens.

Ready to integrate? Follow Add This Block and the Local Usage Example.

Design Reference

This variant follows the corresponding signup design in the shadcn/ui collection. Use the reference to compare the registration column beside a larger cover area, with branding kept close to the form. Adapt the branding, copy and destinations to your product, then follow the Usage Example to connect the form’s callbacks to your authentication service.

This version uses Kamod’s Preact form components and theme tokens. The Kamod cover disappears below 1024px while the form and branding remain. Keep registration requirements and legal information in that persistent column rather than placing them in the artwork.

Inspect the Original Variant’s Source for the reference composition. The Variant Details above describe this implementation’s behavior and integration boundaries.

Use the original as a design reference. To install the Preact version shown here, follow Add This Block and use this page’s Code tab. Its files and imports are prepared for Kamod.

Take the Next Useful Step

You have the pieces. Put them into one real interaction, keep its state in one place, and check the result with the content your application will actually show.

Connect the Foundation

Return to Bring a Complete Layout into Your App to connect this reference to a working screen. Keep global CSS in one entrypoint and import only the components that screen needs.

Build the Surrounding Screen

Find a neighboring interaction in the Component Library, or start with a complete Block. Replace sample content and destinations before refining the layout; a local class change can stay with the composition.

Make the Result Hold Up

Use shared theme roles for changes that belong everywhere. Then review the whole journey: keyboard focus, long labels, narrow screens and a clear way to recover when something fails.

Keep a link to the source and note your intentional changes. Your next edit should begin with a clear decision, not another search.