Castle logo

CASTLE UI

Search

K

Wrap is a layout component used to add space between elements and wraps automatically if there isn't enough space.

Usage

Import

import { Wrap, WrapItem } from '@passfort/castle'

Copy

  • Wrap: Wrap composes the Box component and renders a <ul> tag
  • WrapItem: WrapItem composes the Box component and renders the HTML <li> tag

Example

Think of Wrap component as a flex box container with flex-wrap and spacing support. It works really well with things like dialog buttons, tags, and chips.

In the example below, you see that the last Box wrapped to the next line..

Copy

live example

Change the spacing

Pass the spacing prop to apply consistent spacing between each child, even if it wraps.

Copy

live example

Contents