Tiles
Tiles is a layout component that arranges all child components side by side, optimizing the use of available space. It divides its area into multiple rectangles or tiles, assigning one to each child component. Each of these rectangles is of equal size and they do not overlap.
Reference
Type definitions
Positioning
Absolute
A component is absolutely positioned when it specifies style properties such as top
, left
, right
, bottom
, or rotation
. These properties determine the component’s position relative to its parent. However, the parent component must support absolute positioning for these values to take effect.
Static
Tiles
determine the number of rows and columns in which children should be placed, based on several factors:
- The size of the
Tiles
component. - The aspect ratio of a single tile (specified by the
titleAspectRatio
field). - The number of child components.
An optimal configuration of rows and columns aims to utilize the largest possible area of the component. Children are positioned in the order they appear, from left to right, and arranged row-by-row from top to bottom.
The placement and sizing behavior of child components varies depending on their type, as detailed in the table below:
Component Type | Behavior |
---|---|
Non-layout Component | Scales proportionally to fit inside the parent. If the aspect ratios do not match, the component will be centered vertically or horizontally. |
Layout Component | Takes the width and height of a tile, ignoring its own width/height fields if they are defined. |
Transitions
Tiles
do not support size transitions in the same way as View
or Rescaler
. The transitions provided by Tiles
are predefined and applied automatically, but you can customize them using transition
prop. Currently, we support:
- Adding a new component - when a component is added, all existing components shift to their new locations within a period defined by
transition.duration_ms
. At the end of this transition, the new child component appears without any animation. - Removing an existing component - when a component is removed, the tile containing that item disappears immediately without animation. Subsequently, the remaining elements relocate to their new positions within the time specified by
transition.duration_ms
. - Reordering child components - whenever the order of the children is changed, the elements relocate to their new positions within the time specified by
transition.duration_ms
.
Adding, removing, or reordering Tiles
content requires a method to identify child components. This is essential to determine whether a specific child in a scene update should be treated as the same item from a previous scene.
Description of the identifying logic
Props
children
Content to be displayed within the Tile
.
- Type:
ReactNode
id
ID of a component.
- Type:
string
- Default value: Value produced by
useId
hook
style
Tiles styling properties.
- Type:
TilesStyleProps
transition
Specification of the transition properties to be applied while reordering Tiles
children
- Type:
Transition