Skip to content
All blocks

[30] Forms

Profile Form

An avatar with change and remove buttons, first and last name, a username with an @ prefix and a bio.

1280px

Copy the code

One file with one component and its sample data. It needs @vaneui/ui and its stylesheet, set up as in the installation guide. It passes an onSubmit handler, so in the Next.js App Router add "use client" at the top of its file.

profile.tsx

import { Avatar, Button, Card, Col, Container, Field, Grid2, PageTitle, Row, Section, Text } from "@vaneui/ui";
export function Profile() {
return (
<Section>
<Container itemsStretch>
<Col lg className="max-w-2xl">
<Col xs>
<PageTitle>Profile</PageTitle>
<Text secondary>This is how other people see you in Acme.</Text>
</Col>
<Card tag="form" onSubmit={(e) => e.preventDefault()}>
<Row lg>
<Avatar xl name="Ana Diaz" alt="" />
<Col sm>
<Row sm flexWrap>
<Button type="button">Change photo</Button>
<Button type="button" ghost danger>Remove</Button>
</Row>
<Text xs tertiary>JPG or PNG, at least 256 by 256 pixels.</Text>
</Col>
</Row>
<Grid2>
<Field type="text" label="First name" name="firstName" defaultValue="Ana" autoComplete="given-name" />
<Field type="text" label="Last name" name="lastName" defaultValue="Diaz" autoComplete="family-name" />
</Grid2>
<Field type="text" label="Username" name="username" defaultValue="anadiaz" startSection="@"
description="Your profile lives at acme.com/@anadiaz." autoComplete="username" />
<Field textarea label="Bio" name="bio" defaultValue="Product designer on the billing team. Ask me about forms."
description="Shown on your profile and next to your comments." />
<Row justifyEnd mobileStack itemsStretch>
<Button type="button" secondary mobileWFull>Cancel</Button>
<Button type="submit" filled mobileWFull>Save profile</Button>
</Row>
</Card>
</Col>
</Container>
</Section>
);
}

How it adapts

  • 768px and up: first and last name share a row, in a card at most 672px wide.
  • Below 768px: the names stack, and Cancel and Save stack and fill the width.
  • The photo buttons wrap under each other beside the avatar when the row is narrow.

How these props work is in responsive page sections without breakpoint classes.

Adapt it with your coding agent

Add the VaneUI MCP server, and your agent reads the component docs and prop tables while it changes the block: the copy, the sample data or the layout.

$ claude mcp add vaneui -- npx -y @vaneui/mcp

Setup for other editors is in the AI assistants guide.