Duostrap Input
A single-line text input styled with archived Duostrap field visuals over Base Input.
Duostrap Input applies classic forms.less field styling (4px radius, inset shadow, blue focus glow, and #eee disabled/read-only fill) to Base Input, while preserving the archived light control palette in dark hosts.
Preview
Section titled “Preview” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div
id="bs2-input-demo"
class="flex w-full max-w-md flex-col gap-4"
>
<div class="flex flex-col gap-1">
<div class="text-sm font-medium">Project name</div>
<proto-ui-duostrap-input-root></proto-ui-duostrap-input-root>
<div class="text-xs text-muted-foreground">
Shown in navigation headers and workspace links.
</div>
</div>
<div class="flex flex-col gap-1">
<div class="text-sm font-medium">Disabled</div>
<proto-ui-duostrap-input-root></proto-ui-duostrap-input-root>
</div>
<div class="flex flex-col gap-1">
<div class="text-sm font-medium">Read only</div>
<proto-ui-duostrap-input-root></proto-ui-duostrap-input-root>
</div>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const props = [
{
defaultValue: 'Proto UI',
placeholder: 'Name this project',
ariaLabel: 'Project name',
name: 'project-name',
maxLength: 80,
},
{
defaultValue: 'Archived workspace',
disabled: true,
ariaLabel: 'Disabled project name',
},
{
defaultValue: 'https://example.com/proto-ui',
readOnly: true,
inputMode: 'url',
ariaLabel: 'Read-only workspace URL',
},
];
document
.querySelectorAll(
'#bs2-input-demo proto-ui-duostrap-input-root'
)
.forEach((el, index) => {
setElementProps(el, props[index]);
});
</script>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases; import from @proto.ui/prototypes-duostrap/input. Browse the implemented subset.
import { DuostrapInputRoot } from '@/components/ui/duostrap-input';
export function Example() { return <DuostrapInputRoot placeholder="Type something..." ariaLabel="Basic input" />;}- Values and events: Supports controlled
valueand uncontrolleddefaultValue, along with normalized editing and IME composition events. - Read-only and disabled:
readOnlykeeps the input focusable and selectable without editing;disabledprevents focus and edits, both styled with the classic#eeefill. - Field composition: Pair with Duostrap
Fieldwhen you need labels, helper descriptions, or red validation highlights.
Examples
Section titled “Examples”A standalone Duostrap text input.
Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<proto-ui-duostrap-input-root
id="bs2-input-basic"
></proto-ui-duostrap-input-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(document.querySelector('#bs2-input-basic'), {
placeholder: 'Type something...',
ariaLabel: 'Basic input',
});
</script>Compose Field, FieldLabel, FieldControl, and FieldDescription for labeled form inputs.
Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<proto-ui-duostrap-field-root id="bs2-input-field">
<proto-ui-duostrap-field-label>
Username
</proto-ui-duostrap-field-label>
<proto-ui-duostrap-field-control></proto-ui-duostrap-field-control>
<proto-ui-duostrap-field-description>
Choose a unique username for your account.
</proto-ui-duostrap-field-description>
</proto-ui-duostrap-field-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(
document.querySelector(
'#bs2-input-field proto-ui-duostrap-field-control'
),
{
placeholder: 'Enter your username',
autoComplete: 'username',
}
);
</script>Invalid
Section titled “Invalid”Set invalid and errors on Field to display the classic #953b39 error border and focus glow.
Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<proto-ui-duostrap-field-root id="bs2-input-invalid">
<proto-ui-duostrap-field-label>
Input with error
</proto-ui-duostrap-field-label>
<proto-ui-duostrap-field-control></proto-ui-duostrap-field-control>
<proto-ui-duostrap-field-error>
Please correct the error.
</proto-ui-duostrap-field-error>
</proto-ui-duostrap-field-root>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector('#bs2-input-invalid');
setElementProps(root, {
invalid: true,
errors: ['Please correct the error.'],
});
setElementProps(
root.querySelector('proto-ui-duostrap-field-control'),
{
defaultValue: 'invalid-handle',
placeholder: 'Username',
}
);
</script>Inline
Section titled “Inline”Pair Input with Duostrap Button horizontally for a classic inline search bar.
Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div class="flex w-full max-w-md items-start gap-2">
<proto-ui-duostrap-input-root
id="bs2-input-search"
></proto-ui-duostrap-input-root>
<proto-ui-duostrap-button>Search</proto-ui-duostrap-button>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(document.querySelector('#bs2-input-search'), {
placeholder: 'Search...',
inputMode: 'search',
enterKeyHint: 'search',
ariaLabel: 'Search',
});
</script>Root Props
Section titled “Root Props”| Prop | Type | Default |
|---|---|---|
value | string | undefined |
defaultValue | string | '' |
disabled | boolean | false |
readOnly | boolean | false |
placeholder | string | '' |
required | boolean | false |
name | string | '' |
autoComplete | string | '' |
minLength | number | -1 |
maxLength | number | -1 |
inputMode | 'none' 'text' 'tel' 'url' 'email' 'numeric' 'decimal' 'search' | undefined |
enterKeyHint | 'enter' 'done' 'go' 'next' 'previous' 'search' 'send' | undefined |
ariaLabel | string | '' |
labelledBy | string | '' |
describedBy | string | '' |
Exposed States, Methods, and Events
Section titled “Exposed States, Methods, and Events”- States:
value,disabled,readOnly,focused,focusVisible,composing - Methods:
focusSelf(options?),blurSelf(),resetValue(value?: string): boolean - Events:
valueChange,change,compositionStart,compositionUpdate,compositionEnd