Skip to content

AisInputGroup ​

Build custom controls by grouping inputs and selects with text, icons, buttons, and menus. Input groups are useful for building toolbars, filters, and standalone form controls. Use AisAddon to attach text and icons.

Props ​

size ​

The size prop takes the standard sm, md, and lg values and adjusts the size of the input group accordingly. AisInputGroup will also inherit its size from a surrounding AisForm, AisFieldset, or AisField. In this example, the size could have been set on the field.

Select group size

Layout ​

AisInputGroup creates a flex context to handle its children, but AIS developers will need to specify layout details for the children to get an exact look and feel. One option is to set an explicit width (i.e. w-72) or tell the child to fill the whole container (i.e. flex-1). A number of examples are included below to help you get started.

Grow ​

Use the flex and flex-grow utilities to specify how an individual element in an input group should expand to fill its container. Ais Components also introduces grow-2 and grow-3 to further specify the growth ratios.

Admin

Explicit width ​

At times, you will want to explicitly control the size of elements as neither the container size or default element size will make sense. Use the width utilities to customize an element's width. You can set the width on either the input group itself or on individual elements in the group. Be sure to test your design at multiple screen sizes. Note that AisAddon will not grow.

Admin

Examples ​

AisInputGroup allows developers to mix and match many different elements. We include a variety of examples below to help you get started.

Select ​

Note we have an alignment issue for sizes medium and above. We are working to resolve this issue.

Checkbox ​

Sign and accept terms

Radio ​

What will the temperature be tomorrow?

Compound Groups ​

It is possible to create interesting input groups with multiple elements, but developers should be wary of building complicated groups. AisInputGroup has no inherent responsiveness. A complicated group may need to be hidden and re-implemented as stacked controls on small screens. Always test your designs at a variety of screen sizes.

Accessibility ​

When using input groups, you must make sure all form elements have a label. Wrapping a group in AisField will ensure the first form element has an associated label. You must explicitly create label tags for any additional form elements in the group. Use the class sr-only to only expose the labels to screen readers.