mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-03 18:48:06 +09:00
## Summary - move the complete GitBook documentation tree and assets into Builder under `/docs` - generate the exhaustive MCP page from the local CLI source in the same change - publish GitBook from a release-gated `docs` branch containing the exact successfully released revision - run MCP documentation tests, typechecking, and stale-output checks with the existing generated-docs check - remove links to the Community Discussions repository ## Technical choices - Import the current documentation as a linear snapshot so the branch satisfies Builder's required-linear-history protection. - Keep the Markdown wrapper separate from the TypeScript generator at `scripts/docs/mcp-page.md`. - Generate through `packages/cli/local.js` so CLI guidance and its documentation are reviewed together. - Let `check:generated-docs` reject CLI changes that leave the committed MCP page stale. - After both GitHub release creation and package publication succeed, fast-forward the read-only `docs` branch to the immutable release tag commit. A divergent update fails instead of publishing a different revision. - Configure GitBook to publish `/docs` from the `docs` branch, not directly from `main`. - Exclude `/docs` from the repository-wide `oxfmt` scan so imported GitBook Markdown retains its established formatting; generator tests and stale-output checks still validate the MCP page. - Exclude `transcripts/` and GitHub Discussions from the migration. ## Todo - [x] Import documentation, navigation, includes, and assets under `/docs`. - [x] Generate the MCP page from the local CLI source. - [x] Move MCP generation and validation into Builder. - [x] Require MCP documentation updates alongside CLI changes. - [x] Publish released revisions through a read-only `docs` branch. - [x] Remove Community repository links from Builder and the migrated docs. - [x] Preserve and verify a final Community Git bundle locally. - [ ] Merge this pull request. - [ ] Let the next successful release create or advance the `docs` branch. - [ ] Repoint GitBook Git Sync to `webstudio-is/webstudio`, branch `docs`, root directory `/docs`. - [ ] Verify `docs.webstudio.is`, navigation, assets, anchors, and the MCP page in production. - [ ] Delete `webstudio-is/webstudio-community`. ## Verification - `pnpm check:generated-docs` - `pnpm lint` - `pnpm oxfmt --check` - `git diff --check origin/main...HEAD` - generator regression test demonstrated failing when the GitBook wrapper behavior was removed, then passing after restoration - no fixture inputs or outputs are affected ## Known limitation All documentation merged after the previous release waits for the next successful release before GitBook publishes it. This deliberately keeps the public MCP reference aligned with an installable CLI revision. Ref #5986
5.1 KiB
5.1 KiB
description
| description |
|---|
| Add text input fields to forms in Webstudio. |
Input
See MDN: <input>
The Input component creates an HTML <input> element for collecting user data in forms.
Overview
Input is a fundamental form control used to collect various types of user data including text, numbers, emails, passwords, and more.
Properties
| Property | Type | Description |
|---|---|---|
type |
string | Input type (text, email, password, number, etc.) |
name |
string | Form field name (used in form submission) |
placeholder |
string | Hint text shown when empty |
value |
string | Current input value |
required |
boolean | Whether the field is required |
disabled |
boolean | Whether the input is disabled |
readonly |
boolean | Whether the input is read-only |
autocomplete |
string | Browser autocomplete behavior |
id |
string | Unique identifier |
class |
string | CSS class names |
Input Types
| Type | Use Case |
|---|---|
text |
General text input (default) |
email |
Email addresses (with validation) |
password |
Hidden text entry |
number |
Numeric values |
tel |
Phone numbers |
url |
Website URLs |
search |
Search queries |
date |
Date picker |
time |
Time picker |
datetime-local |
Date and time |
file |
File uploads |
hidden |
Hidden form data |
Form Usage
Inputs should be placed within a Form or Webhook Form:
Form
├── Label (for: email-input)
├── Input (id: email-input, name: email, type: email)
├── Label (for: password-input)
├── Input (id: password-input, name: password, type: password)
└── Button (type: submit)
Associating Labels
Always associate inputs with labels for accessibility:
Method 1: Matching IDs
- Set
idon the Input (e.g., "email") - Set
foron the Label (e.g., "email")
Method 2: Wrapping
Place the Input inside a Label component.
Validation
Built-in Validation
HTML5 provides built-in validation for certain input types:
emailvalidates email formaturlvalidates URL formatnumbervalidates numeric input
Required Fields
Set required: true to make a field mandatory.
Pattern Matching
Use the pattern attribute for custom validation with regex.
Styling States
Style different input states:
| State | Selector | Use |
|---|---|---|
| Default | - | Normal state |
| Focus | :focus |
When input is selected |
| Hover | :hover |
Mouse over |
| Disabled | :disabled |
When disabled |
| Invalid | :invalid |
Validation failed |
| Valid | :valid |
Validation passed |
| Placeholder | ::placeholder |
Placeholder text |
Example Styles
- Border:
1px solid #ccc, change on focus - Padding:
8px 12pxfor comfortable typing - Border Radius: Slight rounding looks modern
- Focus Ring: Use outline or box-shadow for accessibility
Best Practices
- Always use labels: Every input needs an associated label
- Use appropriate types: Use
emailfor emails,telfor phones, etc. - Provide placeholders wisely: Don't use placeholder as label replacement
- Show validation feedback: Indicate errors clearly
- Ensure touch targets: Minimum 44x44px for mobile
- Support autocomplete: Use proper
autocompletevalues
Autocomplete Values
Common autocomplete values:
| Value | Use |
|---|---|
name |
Full name |
email |
Email address |
tel |
Phone number |
street-address |
Street address |
postal-code |
ZIP/postal code |
country |
Country |
cc-number |
Credit card number |
current-password |
Current password |
new-password |
New password |
Related Components
- Form - Form container
- Webhook Form - Form with webhook submission
- Label - Input labels
- Textarea - Multi-line text input
- Select - Dropdown selection
Related Videos
{% embed url="https://www.youtube.com/watch?v=SOd7V8A9SOw" %}