diff --git a/apps/v4/content/docs/components/base/input-group.mdx b/apps/v4/content/docs/components/base/input-group.mdx index 61fad7c6a8..3234106697 100644 --- a/apps/v4/content/docs/components/base/input-group.mdx +++ b/apps/v4/content/docs/components/base/input-group.mdx @@ -1,6 +1,6 @@ --- title: Input Group -description: Display additional information or actions to an input or textarea. +description: Add addons, buttons, and helper content to inputs. base: base component: true --- @@ -10,7 +10,7 @@ import { IconInfoCircle } from "@tabler/icons-react" ## Installation @@ -68,12 +68,59 @@ import { - - Search - ``` +## Align + +Use the `align` prop on `InputGroupAddon` to position the addon relative to the input. + + + For proper focus management, `InputGroupAddon` should always be placed after + `InputGroupInput` or `InputGroupTextarea` in the DOM. Use the `align` prop to + visually position the addon. + + +### inline-start + +Use `align="inline-start"` to position the addon at the start of the input. This is the default. + + + +### inline-end + +Use `align="inline-end"` to position the addon at the end of the input. + + + +### block-start + +Use `align="block-start"` to position the addon above the input. + + + +### block-end + +Use `align="block-end"` to position the addon below the input. + + + ## Examples ### Icon @@ -81,119 +128,69 @@ import { ### Text -Display additional text information alongside inputs. - ### Button -Add buttons to perform actions within the input group. - -### Tooltip - -Add tooltips to provide additional context or help. +### Kbd - -### Textarea - -Input groups also work with textarea components. Use `block-start` or `block-end` for alignment. - - - -### Spinner - -Show loading indicators while processing input. - - - -### Label - -Add labels within input groups to improve accessibility. - - ### Dropdown -Pair input groups with dropdown menus for complex interactions. - -### Button Group - -Wrap input groups with button groups to create prefixes and suffixes. +### Spinner + +### Textarea + + ### Custom Input -Add the `data-slot="input-group-control"` attribute to your custom input for automatic behavior and focus state handling. +Add the `data-slot="input-group-control"` attribute to your custom input for automatic focus state handling. -No style is applied to the custom input. Apply your own styles using the `className` prop. +Here's an example of a custom resizable textarea from a third-party library. -```tsx showLineNumbers -import { InputGroup, InputGroupAddon } from "@/component/ui/input-group" -import TextareaAutosize from "react-textarea-autosize" - -export function InputGroupCustom() { - return ( - - - how - - ) -} -``` - ## API Reference ### InputGroup @@ -297,8 +294,3 @@ All other props are passed through to the underlying `