BumpyClock/agent-templates / skills_archive/web-development
web-development
UnverifiedWeb apps: HTML, CSS, JS, TS, React, Next.js, shadcn/ui, accessibility, forms, motion, responsive, performance, react-doctor.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.3 KB |
| agents/openai.yaml | config | 326 B |
| design-engineering/PRACTICAL-TIPS.md | markdown | 6.3 KB |
| design-engineering/aesthetic-direction.md | markdown | 3.8 KB |
| design-engineering/animations.md | markdown | 8.1 KB |
| design-engineering/component-design.md | markdown | 7.2 KB |
| design-engineering/forms-controls.md | markdown | 4.9 KB |
| design-engineering/guide.md | markdown | 4.7 KB |
| design-engineering/marketing.md | markdown | 3.4 KB |
| design-engineering/performance.md | markdown | 4.7 KB |
| design-engineering/touch-accessibility.md | markdown | 4.8 KB |
| design-engineering/ui-polish.md | markdown | 6.2 KB |
| react/guide.md | markdown | 1.7 KB |
| react/react-doctor.md | markdown | 622 B |
| shadcn/guide.md | markdown | 10.8 KB |
| shadcn/references/install-nextjs.md | markdown | 715 B |
| shadcn/references/install-tanstack.md | markdown | 832 B |
| shadcn/references/install-vite.md | markdown | 2.5 KB |
design-engineering/forms-controls.md
View on GitHub# Forms & Controls
Inputs, buttons, forms, and interactive controls.
## Inputs
### Labels
Clicking the input label should focus the input field. Always associate labels with inputs:
```html
<label for="email">Email</label>
<input id="email" type="email" />
<!-- Or wrap the input -->
<label>
Email
<input type="email" />
</label>
```
### Input Types
Use appropriate `type` attributes:
```html
<input type="email" />
<input type="password" />
<input type="tel" />
<input type="url" />
<input type="number" />
<input type="search" />
```
### Autocomplete and Spellcheck
Disable `spellcheck` and `autocomplete` most of the time for cleaner UX:
```html
<input
type="text"
spellcheck="false"
autocomplete="off"
/>
```
### 1Password Integration
Disable 1Password autocomplete when not needed:
```html
<input data-lpignore="true" data-1p-ignore />
```
### Input Decorations
Prefix and suffix decorations (icons, labels) should be:
- Absolutely positioned on top of the text input with padding
- Not placed next to the input as siblings
- Should trigger focus on the input when clicked
```css
.input-wrapper {
position: relative;
}
.input-icon {
position: absolute;
left: 12px;
top: 50%;
transform: translateY(-50%);
pointer-events: none;
}
.input-field {
padding-left: 40px;
}
```
For clickable icons (like clear button):
```jsx
<button
className="input-icon-button"
onClick={() => inputRef.current?.focus()}
>
<SearchIcon />
</button>
```
### Font Size (iOS)
Ensure input font size is at least 16px to prevent zooming on iOS:
```css
input, textarea, select {
font-size: 16px;
}
```
Inputs smaller than 16px cause iOS Safari to zoom in on focus.
### Autofocus
- Autofocus on inputs when a modal opens (if an input exists in the modal)
- Do NOT autofocus inputs on touch devices—it opens the keyboard unexpectedly
```jsx
// Check for touch device before autofocus
const isTouchDevice = 'ontouchstart' in window;
<input autoFocus={!isTouchDevice} />
```
## Forms
### Form Wrapper
Inputs should be wrapped with a `<form>` to submit by pressing Enter:
```html
<form onSubmit={handleSubmit}>
<input type="text" />
<button type="submit">Submit</button>
</form>
```
### Keyboard Submission
Ensure `Cmd+Enter` (Mac) / `Ctrl+Enter` (Windows) submits the form, especially for textareas:
```jsx
function handleKeyDown(e) {
if ((e.metaKey || e.ctrlKey) && e.key === 'Enter') {
handleSubmit();
}
}
```
### Prefilling Forms
- Use logged-in user's data to prefill forms when possible
- When linking to a form, prefill content based on the request context
Example: If a user clicks "Change username", prefill with:
> "I'd like to change my username to:"
If you can prefill any user data based on the logged-in user, do that.
## Buttons
### Semantic Elements
A button should always be a `<button>`. Don't add click events on elements that aren't buttons:
```html
<!-- Good -->
<button onClick={handleClick}>Click me</button>
<!-- Bad -->
<div onClick={handleClick}>Click me</div>
<span onClick={handleClick}>Click me</span>
```
### Disabled After Submission
Disable buttons after submission to avoid duplicate network requests:
```jsx
const [isSubmitting, setIsSubmitting] = useState(false);
<button
disabled={isSubmitting}
onClick={async () => {
setIsSubmitting(true);
await submitForm();
setIsSubmitting(false);
}}
>
{isSubmitting ? 'Submitting...' : 'Submit'}
</button>
```
### Button Shortcuts
If a button's action can also be performed with a keyboard shortcut, show that shortcut as a tooltip on the button:
```jsx
<Tooltip content="Save (Cmd+S)">
<button onClick={save}>Save</button>
</Tooltip>
```
### Button Press Feel
Add `transform: scale(0.97)` on `:active` to make buttons feel responsive:
```css
.button:active {
transform: scale(0.97);
}
```
## Checkboxes and Controls
### Dead Zones
Avoid dead zones on checkboxes and controls. The space between label and control should also be clickable:
```css
.checkbox-wrapper {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
}
/* Make the entire row clickable, not just the checkbox */
.checkbox-wrapper label {
cursor: pointer;
flex: 1;
}
```
Or use a label that wraps everything:
```html
<label class="checkbox-row">
<input type="checkbox" />
<span>Remember me</span>
</label>
```
## Destructive Actions
Ensure destructive actions require confirmation:
```jsx
function handleDelete() {
if (confirm('Are you sure you want to delete this?')) {
deleteItem();
}
}
```
For better UX, use a proper confirmation modal instead of `confirm()`.
## Component Libraries
Use Base UI for accessible component primitives. If it doesn't fit the codebase, use whatever else fits, but ensure accessibility is maintained.
## Error Handling
Colocate errors—show error messages close to the field that caused them:
```jsx
<div className="field">
<input type="email" aria-invalid={!!error} />
{error && <span className="error">{error}</span>}
</div>
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |