Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Minimal Single Question Form Block for React

The calmest form: one page with a mark, a heading that asks one question, one field with a hidden label and one full-width button, with the answer or the one problem shown under the field.

Framework
UI library

Preview

Preview width

Installation

Part of Pro
Pro unlocks the code and one-line install of every Pro button and text effect, plus the MCP for your AI editor.
Have Pro already? Sign in to open it.Opens here as soon as you're Pro.

Overview

Ask one thing and get out of the way, with this minimal form for React with Base UI. It is a whole page: the page's rails and one band across the screen frame a mark, the heading "Name your workspace", one sentence, one Input and, under it, the one full-width Shine Button. The field's label is real but visually hidden, so the page stays quiet while every control is still named; the placeholder is only an example. A name under two characters is called out when you press Enter or Continue and focus returns to the field; a good name replaces that line under the field with what happened ("“Fieldnote Studio” is ready, in this demo."). That line is the page's one polite status, and it keeps its height, so nothing moves. It's built from Input, Field, Shine Button and Guides, with a CSS entrance only. For a first step, a rename, a single setting or any screen that asks one question.

FAQ

Why is the label hidden, and is that accessible?

The heading is the visible question, and the form is named by it. The field also has a real label, "Workspace name", hidden with sr-only (not removed), so a screen reader, a voice-control user and a click on the label all still reach the field. The placeholder is an example of an answer, never the label; it disappears when you type, so nothing important lives in it.

When does it say the name is too short?

Only when you press Enter or Continue, never while you type: nobody is wrong after one letter. The problem appears in the line under the field, which already holds its space, focus goes back to the field and the line is read out because it is the page's polite status. Typing clears it. Change the rule in problemOf and the minimum in MIN.

Why is it one screen, and where does the primary button end up?

A page with one question has nothing to scroll, so the heading, the field and the button are all on the first screen on a desktop and on a phone, centred a little above the middle with more room under than over. The button is the only filled control; the link under it is quiet text.

What stays local, and how do I connect it for real?

Nothing is created: Continue only shows the answer. In a real app, create the workspace in the submit handler, keep the button pressed while you wait (a busy button keeps its size) and then move on to the next screen; if it fails, say what failed in the same line under the field and keep the name in the box.

How do I connect it to react-hook-form or TanStack Form?

With one field you may not need a library, but the wiring is short. With react-hook-form, register the field with Controller, put the rule in a resolver and let handleSubmit run on Enter and on the button; shouldFocusError returns focus to the field. With TanStack Form, give the field an onSubmit validator and show its first error in the line under the field.

  • Pro

    A form panel with one required project-name field that shows the web address it will get as you type, flags a name that is taken or past 50 characters, and offers the next free address.

  • Pro

    A bare sign-in page for a plain-text notes app: a heading, one sentence, an email and a password written on a hairline and one Sign in button, set at the start of the page with no card, providers or footer.

  • Pro

    The calmest contact form, for a mail client: a centred heading and three fields on the page column with inline validation, a message counter and a one-line thank-you.

  • Pro

    The sign-in pair done well: an email named for password managers, a password with a reveal button and a Caps Lock warning, one generic failure that never says which half was wrong, and a quiet band with the demo account.

  • Pro

    A master-password form with advice instead of a checklist: a four-segment meter, one sentence that names the weakest thing about what is typed, a polite confirm field and a side cell that explains the four segments.

  • Pro

    A page editor whose toolbar really formats: Bold, Italic, Bullet list and Link wrap the selection in Markdown, shortcuts work, the toolbar is one tab stop with arrow keys, and a Preview tab renders the result.