Tile
Tiles are container components. Use them to group similar components or to wrap components which the user may reorder or resize.
tip
To learn more about how to use Tiles refer to the Tile pattern documentation.
Example
Usage Rules
Don’t:
- Nest tiles
Variants
Actions
Tile Actions provide controls in the context of the Tile's content. They may contain input components such as an IconButton or Input. Actions may have a size of $spacing-4
(32px).
To learn more about how to use Tile actions refer to the Tile pattern documentation.
Clickable
You can add onClick
to handle the click event.
Contentless
You can use the Tile without content without providing the child element.
note
If ESLint's react/jsx-key
rule is active make sure to set a key on the individual action components!
Disabled
The Tile can be disabled by adding prop disabled
to the component.
Draggable
The Tile comes with properties that set styles to indicate whether a Tile is draggable or currently being dragged.
It also supports react-grid-layout for dragging functionality. See an example here.
Full Height
You can set the height of Tile to be 100% of container element by adding prop fullHeight
.
Icon
You can add icons to Tile by passing appId
and appName
or iconName
. Both appId
and appName
are required to render the appIcon.
Icon customization
- You can custom Icon by using
customIcon
prop with React Element. Icon can be customised with Icons component or external svg component. - Using
iconPosition
to set icon position such asleft
orright
. - Using
customIconSize
to set the width and height of icon such as32
,64
, ... with24
(medium icon size) is default size.
ShowOverflow
The Tile component's overflow
is set to 'hidden' by default but if there is a case you need it to be visible you can use showOverflow
prop to achieve it.
Resizable
The Tile comes with properties that set styles to indicate whether a Tile is resizable or currently being resized.
It also supports react-grid-layout for resizing functionality. See an example here.
Title & Optional Badge & CTA Button
title
anddescription
are optional props to display the title and description in Tile Header.description
also suppoprts rich text tag such as<b>
,<i>
,<a>
and<strong>
.titleBadge
is an optional prop to show a badge beside the Title.actions
prop can provide the CTA button on the right side. Please use only the Atlas Button component with the default Button kind and size.
Title & Description
title
anddescription
are optional props to display the title and description in Tile Header.description
also suppoprts rich text tag such as<b>
,<i>
,<a>
and<strong>
.
You can provide onTitleChange
prop to make the title editable.
Titles could also be represented with ReactNode
.
note
ReactNode
passed to <Tile>
will be rendered within a component that sets title font styles to ensure consistent text display.
You can set titleRequired
to true
to disallow the use of an empty string as the title value.
Sidebar
The Tile also supports a Sidebar by using props:
sidebar.content
sidebar.isOpen
sidebar.onClosed
sidebar.closeButtonLabel
sidebar.secondaryButtonLabel
,sidebar.onSecondaryClick
,sidebar.sidebarWidth
,sidebar.justifyContent
Examples
Drag-and-drop and resizing Tiles using react-grid-layout
The following example shows how to set up drag-and-drop and resizing of the Tile using react-grid-layout.
Note that additional global styling is required to enable the same UX as you can find in the design specifications. Especially, for the drag and resizing placeholder (see here).
Tile with a scrolling Panel inside
Tile with Scrollable Table
Props
Name | Type | Default |
---|---|---|
title The title of the Tile |
| — |
description The description of the Tile |
| — |
iconPosition The icon position (left or right of title) |
| "left" |
appId The appId of app icon that would appear next to the title |
| — |
appName The appName of app icon that would appear next to the title |
| — |
iconName Name of the Icon that would appear next to the title. Please refer to the full list of icons here: Link | "AddValue" | "AppGrid" | "ArrowCircleLeft" | "ArrowCircleRight" | "ArrowDown" | "ArrowDownLeft" | "A... | — |
customIcon The icon that would appear next to the title |
| — |
customIconSize The size of custom Icon, eg: 32 (32x32), 64 (64x64) |
| 24 |
titlePlaceholder Placeholder for the title. Used only for editable title |
| — |
titleRequired Can be set to true to disallow the use of an empty string as the title value. |
| false |
titleBadge A badge content for the title |
| — |
onTitleChange Callback on the title change. Can be provided to make the title editable |
| — |
actions A list of tile actions. |
| [] |
padding This will define padding in the body of the Tile. |
| — |
showOverflow This will make the overflow visible |
| — |
draggable This will activate a styling indicating that the tile is draggable |
| — |
dragging This will activate a styling indicating that the tile is currently being dragged. It only works if draggable is set. |
| — |
resizable This will activate a styling indicating that the tile is resizable |
| — |
resizing This will activate a styling indicating that the tile is currently being resized. It only works if resizable is set. |
| — |
children The content of the tile |
| — |
onClick onClick function to handle clicks |
| — |
sidebar The sidebar displayed within the tile | { content: ReactNode; isOpen: boolean; onClosed: () => void; closeButtonLabel?: string; sidebarWidth... | — |
disabled Allow to disable tile |
| — |
fullHeight Allow to display tile with 100% height of container |
| — |
css Add custom styles to this component. Use with caution. Learn more here: Link |
| — |
inputFieldCss |
| — |
data-{foo} Data attributes can be used by testing libraries to retrieve components or assert their existence |
| — |
* - the prop is required. |