Inline form

Pairs one field with an embedded submit action. The button appears after validation.

List

Press notes

One field, one action, inside the same hairline.

Use it for

  • One value and one action: newsletter, invite by e-mail, join a waitlist.
  • validate to decide when the action appears; the default is a loose e-mail check.

Not for

  • More than one field; use Form with Field.
  • Actions with side effects that need confirmation; the success state is immediate.

Three ways in. They share one source, so the pixels match whichever you pick.

1. Import the package

npm install @noorddev/vlak-react

// once, next to your app's root
import "@noorddev/vlak-react/css";

import { InlineForm } from "@noorddev/vlak-react";

Precompiled React and one stylesheet. No compiler to configure. Per-component imports work too: @noorddev/vlak-react/components/inline-form.

2. Vendor the source

npx @noorddev/vlak-cli add inline-form

The StyleX leaf lands in components/vlak/ with its dependencies, for your own compiler to own. See StyleX.

3. Through shadcn

npx shadcn add https://vlak.dev/r/inline-form.json

The same registry item, installed by shadcn's CLI.

CSS only

<link rel="stylesheet" href="node_modules/@noorddev/vlak/css/vlak.css" />

No React. Link vlak.css and use the markup and classes below.

import { InlineForm } from "@noorddev/vlak-react";

<InlineForm
  placeholder="Your e-mail"
  buttonLabel="Subscribe"
  inputProps={{ "aria-label": "E-mail", type: "email" }}
  onSubmit={(email) => subscribe(email)}
/>

InlineForm

One field, one action; the action sits inside the field.

PropTypeDefaultDescription
placeholderstring"Your e-mail"
buttonLabelReactNode"Subscribe"
successLabelReactNode"You're on the list"
validate(value: string) => boolean(v) => /.+@.+\..+/.test(v)The action only appears once this returns true. Defaults to a loose e-mail check.
onSubmit(value: string) => void
inputPropsInputHTMLAttributes<HTMLInputElement>

Also accepts Omit<FormHTMLAttributes<HTMLFormElement>, "onSubmit">.

KeysDoes
EnterSubmits once the value validates
TabReaches the button only after the value validates
<div class="rs-inline-field"><input class="rs-inline-input" placeholder="Your e-mail" /><span class="rs-reveal rs-reveal-in"><button class="rs-btn-primary rs-inline-btn">Subscribe</button></span></div>
.rs-inline-field.rs-inline-input.rs-inline-btn.rs-reveal.rs-reveal-in.rs-subscribed.rs-inline-field-btn