Input group
Compose inputs or textareas with addons, actions, hints, menus, and validation.
Default
On this page
Installation
Copy this component and its required dependencies into the consumer-owned Components project.
dotnet fve add input-group --config src/Acme.Components/fve.jsonThe CLI resolves dependencies and preserves consumer-authored files. See Installation for project initialization and Tailwind source detection.
Usage
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let defaultInputGroup =
InputGroup.create "account-reference" "accountReference" "Account reference"
|> InputGroup.renderText addons
Icon and keyboard hint
Textarea footer
Validation
Pending
API reference
type InputGroupPosition =
| Leading
| Trailing
type InputGroupControl =
| Input of InputType
| Textarea of int
type InputGroupAddon
type InputGroupConfig
/// Decorative addons are not focus targets or form values.
/// Interactive addons require accessible names and keep native Tab order.
/// Controls and addons wrap when their preferred widths no longer fit; footers keep their own row.
module InputGroup =
val create : id:string -> name:string -> label:string -> InputGroupConfig
val withInputType : kind:InputType -> config:InputGroupConfig -> InputGroupConfig
val asTextarea : rows:int -> config:InputGroupConfig -> InputGroupConfig
val withValue : value:string -> config:InputGroupConfig -> InputGroupConfig
val withAddon : addon:InputGroupAddon -> config:InputGroupConfig -> InputGroupConfig
val withFooter : footer:HtmlElement -> config:InputGroupConfig -> InputGroupConfig
val withDescription : description:string -> config:InputGroupConfig -> InputGroupConfig
val withValidation : message:string -> config:InputGroupConfig -> InputGroupConfig
val required : config:InputGroupConfig -> InputGroupConfig
val disabled : config:InputGroupConfig -> InputGroupConfig
val pending : config:InputGroupConfig -> InputGroupConfig
val withAttributes : attributes:HtmlAttribute list -> config:InputGroupConfig -> InputGroupConfig
val render : config:InputGroupConfig -> HtmlElement
module InputGroupAddon =
val text : position:InputGroupPosition -> value:string -> InputGroupAddon
val icon : position:InputGroupPosition -> icon:HtmlElement -> InputGroupAddon
val keyboard : position:InputGroupPosition -> hint:string -> InputGroupAddon
val action : position:InputGroupPosition -> action:HtmlElement -> InputGroupAddon