mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-03 02:27:57 +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
4.3 KiB
4.3 KiB
description
| description |
|---|
| Add dropdown select inputs to forms in Webstudio. |
Select (Native)
See MDN: <select>
The native Select component creates an HTML <select> dropdown for choosing one option from a list.
Overview
The native Select component uses the browser's built-in dropdown functionality. For a fully customizable dropdown with complete styling control, see the Radix Select component.
Components
Select
The dropdown container.
| Property | Type | Description |
|---|---|---|
name |
string | Form field name |
value |
string | Currently selected value |
required |
boolean | Whether selection is required |
disabled |
boolean | Whether select is disabled |
multiple |
boolean | Allow multiple selections |
id |
string | Unique identifier |
class |
string | CSS class names |
Option
Individual options within the select.
| Property | Type | Description |
|---|---|---|
value |
string | Value submitted when selected |
selected |
boolean | Whether this option is selected |
disabled |
boolean | Whether option is disabled |
label |
string | Display text (alternative to content) |
Basic Usage
Label (for: country)
└── "Country"
Select (id: country, name: country)
├── Option (value: "") → "Select a country..."
├── Option (value: us) → "United States"
├── Option (value: uk) → "United Kingdom"
├── Option (value: ca) → "Canada"
└── Option (value: au) → "Australia"
Placeholder Option
Create a placeholder with an empty first option:
Option (value: "", disabled: true, selected: true)
└── "Please select..."
This shows hint text but can't be submitted.
Form Submission
When submitted, the selected option's value is sent:
country=us
Styling Limitations
Native select elements have limited styling options:
- Can style: border, background, padding, font
- Cannot style: dropdown arrow, option appearance (varies by browser/OS)
For full styling control, use the Radix Select component.
Basic Styling
/* What you can customize */
Select {
border: 1px solid #ccc;
border-radius: 4px;
padding: 8px 12px;
background: white;
font-size: 16px;
}
Multiple Selection
For selecting multiple options:
Select (name: languages, multiple: true)
├── Option (value: en) → "English"
├── Option (value: es) → "Spanish"
├── Option (value: fr) → "French"
└── Option (value: de) → "German"
Users can Ctrl/Cmd+click to select multiple options.
Accessibility
- Use labels: Always associate with a label
- Include placeholder: Help users understand what to select
- Keyboard support: Native select works with keyboard
- Avoid disabled options: Can be confusing for screen readers
Best Practices
- Use for 5+ options: Use radio buttons for fewer options
- Alphabetize long lists: Or use logical ordering
- Include placeholder: Show default unselected state
- Keep options concise: Long text truncates
- Group related options: Use optgroup for categories (via HTML Embed if needed)
When to Use Native vs Radix Select
| Native Select | Radix Select |
|---|---|
| Simple forms | Custom styling needed |
| Mobile-friendly | Desktop-focused |
| Quick implementation | Searchable options |
| Standard browser behavior | Complex interactions |
| Works everywhere | Advanced features |
Dynamic Options
Populate options from data:
Select (name: category)
└── Collection (data: categories)
└── Option (value: category.id)
└── {category.name}
Related Components
- Radix Select - Fully customizable select
- Radio Button - For fewer options
- Label - Associated labels
- Form - Form container