InputGroup
InputGroup frames an input or textarea with icons, text, buttons or key hints in one field. Use it for search boxes, URL prefixes and inline actions. For a plain field, use Input.
Installation
Run npx nxds-cli@latest init first if nxds isn’t set up in your app yet. See Install.
Usage
Composition
Examples
With button
Add a trailing button for an action on the field's value.
With text
Show a fixed text prefix, such as a URL scheme, before the input.
Alignments
Place addons at the start, end, top or bottom of the field.
With textarea
Pair a textarea with a footer addon below it.
Disabled
Set data-disabled="true" on the group to dim its addons along with the disabled control.
Sizes
Match the height of a standalone Input at each control size.
Props
InputGroup
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "borderless" | "bordered" | null | "bordered" | No description |
InputGroupAddon
| Prop | Type | Default | Description |
|---|---|---|---|
align | "inline-start" | "inline-end" | "block-start" | "block-end" | null | "inline-start" | No description |
InputGroupButton
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | false | Renders the child, such as an |
endIcon | ReactNode | No default documented | Decorative icon after the label. Use |
loading | boolean | false | Disables the button and shows a spinner in place of its content. |
size | "sm" | "icon-sm" | "xs" | "icon-xs" | null | "xs" | No description |
startIcon | ReactNode | No default documented | Decorative icon before the label. Use |
variant | "link" | "default" | "error" | "destructive" | "outline" | "dashed" | "secondary" | "ghost" | null | "ghost" | No description |
InputGroupInput
| Prop | Type | Default | Description |
|---|---|---|---|
size | "default" | "sm" | "lg" | null | "default" | No description |
InputGroupText
InputGroupText adds no props of its own; it accepts the props of the element or primitive it wraps.
InputGroupTextarea
InputGroupTextarea adds no props of its own; it accepts the props of the element or primitive it wraps.
InputGroup frames an input or textarea with icons, text, buttons or key hints in one field. Use it for search boxes, URL prefixes and inline actions. For a plain field, use Input.
Installation
Install these components first:
Copy and paste the following code into your project.
components/input-group/InputGroup.vue components/input-group/InputGroupAddon.vue components/input-group/InputGroupButton.vue components/input-group/InputGroupInput.vue components/input-group/InputGroupText.vue components/input-group/InputGroupTextarea.vue components/input-group/index.ts Keep each file at the path shown above it.
Paths are relative to
packages/vue/src/. Keep the same folders under your@/root, and the imports between files work without edits.
Usage
Examples
With button
Add a trailing button for an action on the field's value.
With text
Show a fixed text prefix, such as a URL scheme, before the input.
Alignments
Place addons at the start, end, top or bottom of the field.
With textarea
Pair a textarea with a footer addon below it.
Disabled
Set data-disabled="true" on the group to dim its addons along with the disabled control.
Sizes
Match the height of a standalone Input at each control size.
Props
InputGroup
| Prop | Type | Default | Description |
|---|---|---|---|
variant | "bordered" | "borderless" | null | "bordered" | No description |
InputGroupAddon
| Prop | Type | Default | Description |
|---|---|---|---|
align | "inline-start" | "inline-end" | "block-start" | "block-end" | null | "inline-start" | No description |
InputGroupButton
| Prop | Type | Default | Description |
|---|---|---|---|
disabled | boolean | No default documented | No description |
loading | boolean | false | Disables the button and shows a spinner in place of its content. |
size | "sm" | "icon-sm" | "xs" | "icon-xs" | null | "xs" | No description |
type | "button" | "submit" | "reset" | "button" | No description |
variant | "default" | "destructive" | "error" | "outline" | "dashed" | "secondary" | "ghost" | "link" | null | "ghost" | No description |
InputGroupInput
| Prop | Type | Default | Description |
|---|---|---|---|
defaultValue | string | number | No default documented | The starting value when |
modelValue | string | number | No default documented | The value, for |
size | "default" | "sm" | "lg" | null | "default" | No description |
InputGroupText
InputGroupText adds no props of its own; it accepts the props of the element or primitive it wraps.
InputGroupTextarea
| Prop | Type | Default | Description |
|---|---|---|---|
defaultValue | string | No default documented | The starting value when |
modelValue | string | No default documented | The value, for |