- Tile Master
- Examples
- Inline Layout (Default)
- Mixed Layout
- Horizontal and vertical alignments
- Vertical top alignment
- Centre alignment
- Bottom alignment
- Padding and gap
- Setting a custom padding
- Setting a custom gap
- Variant
- Base
- Clickable
- Default
- Disabled state
- Multi select and radio (single) select
- Hover exception for multi select & radio
<sl-tile-master> <div slot="prefix">Prefix slot</div> <div slot="body">Body slot</div> <div slot="suffix">Suffix slot</div> </sl-tile-master>
Examples
Inline Layout (Default)
The default inline layout displays all slots in a horizontal row.
<sl-tile-master slot-position="inline"> <div slot="prefix" style="background-color: var(--hds-color-bg-accent-purple-subtle) "> <div class="prefix-content">Inline</div> <div class="prefix-content">Inline</div> </div> <div slot="body" style="background-color: var(--hds-color-bg-accent-purple-subtle)" > <div class="body-content">Body content</div> </div> <div slot="suffix" style="background-color: var(--hds-color-bg-accent-purple-subtle)" > <div class="suffix-content">Inline</div> <div class="suffix-content">Inline</div> </div> </sl-tile-master>
Mixed Layout
Use the mixed layout to display prefix and suffix slots in columns.
<sl-tile-master slot-position="mixed"> <div slot="prefix" style="background-color: var(--hds-color-bg-accent-purple-subtle)" > <div class="prefix-content">Stack</div> <div class="prefix-content">Stack</div> </div> <div slot="body" style="background-color: var(--hds-color-bg-accent-purple-subtle)" > <div class="body-content">Body content</div> </div> <div slot="suffix" style="background-color: var(--hds-color-bg-accent-purple-subtle)" > <div class="suffix-content">Stack</div> <div class="suffix-content">Stack</div> </div> </sl-tile-master>
Horizontal and vertical alignments
Content and elements that are slotted in can be aligned horizontally left, center, or right using the
horizontal-alignment attribute, and vertically top, center, or bottom using the
vertical-alignment attribute.
Vertical top alignment
<sl-tile-master vertical-alignment="top"> <div slot="prefix" style="border: 1px dashed var(--hds-color-lavender-700, #AB88FC);"> Prefix slot </div> <div slot="body" style=" height: 80px; border: 1px dashed var(--hds-color-lavender-700, #AB88FC); "> Body slot </div> <div slot="suffix" style=" border: 1px dashed var(--hds-color-lavender-700, #AB88FC); "> Suffix slot </div> </sl-tile-master>
Centre alignment
<sl-tile-master vertical-alignment="centre"> <div slot="prefix" style=" border: 1px dashed var(--hds-color-lavender-700, #AB88FC); "> Prefix slot </div> <div slot="body" style=" height: 80px; border: 1px dashed var(--hds-color-lavender-700, #AB88FC); "> Body slot </div> <div slot="suffix" style=" border: 1px dashed var(--hds-color-lavender-700, #AB88FC); "> Suffix slot </div> </sl-tile-master>
Bottom alignment
<sl-tile-master vertical-alignment="bottom"> <div slot="prefix" style=" border: 1px dashed var(--hds-color-lavender-700, #AB88FC); "> Prefix slot </div> <div slot="body" style=" height: 80px; border: 1px dashed var(--hds-color-lavender-700, #AB88FC); "> Body slot </div> <div slot="suffix" style=" border: 1px dashed var(--hds-color-lavender-700, #AB88FC); "> Suffix slot </div> </sl-tile-master>
Padding and gap
Setting a custom padding
By default, padding and gap are both set to 16px. However, padding on all four sides can be controlled using
the --padding CSS custom property, while the gap between slot groups can be adjusted using the
--spacing CSS custom property.
<sl-tile-master style="--padding: 3rem;"> <div slot="prefix">The padding</div> <div slot="body">is</div> <div slot="suffix">3rem</div> </sl-tile-master>
Setting a custom gap
<sl-tile-master style="--spacing: 90px;"> <div slot="prefix">The gap</div> <div slot="body">is</div> <div slot="suffix">90px</div> </sl-tile-master>
Variant
Base
Base does not have any states but can only contain one action (such as buttons or links). The whole area of the tile container cannot be the click target.
<sl-tile-master> <div slot="body"> <div class="exampler-body-content"> <div class="exampler-body-header"> <span class="body-title">Tile master</span> <sl-tag variant="primary">Base</sl-tag> </div> <div class="exampler-body-paragraph"> <span>This is an example of a base tile master with sample content and can only have one action.</span> <span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</span> </div> <div class="exampler-body-input-field"> <sl-input placeholder="Type something"></sl-input> </div> <div class="exampler-body-action"> <sl-button>Button</sl-button> </div> </div> </div> </sl-tile-master> <style> .exampler-body-content { display: flex; flex-direction: column; align-items: center; flex: 1 0 0; gap: 16px; } .exampler-body-header { display: flex; justify-content: space-between; align-items: center; align-self: stretch; } </style>
Clickable
Clickable tile master can be used as navigational elements that redirect the user to a new page. This variant has the following states and the whole area of the tile container is the click target. They cannot contain separate internal interactive elements due to accessibility concerns.
Default
Default state
<sl-tile-master clickable> <div slot="body"> <div class="exampler-body-content"> <div class="exampler-body-header"> <span class="body-title">Tile master</span> <sl-tag variant="primary">Clickable</sl-tag> </div> <div class="exampler-body-paragraph"> <span>This is an example of a clickable tile master with sample content. It cannot contain separate interactive elements inside the tile.</span> <span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</span> </div> <div class="exampler-body-action"> <sl-button>Button</sl-button> </div> </div> </div> </sl-tile-master> <style> .exampler-body-content { display: flex; flex-direction: column; align-items: center; flex: 1 0 0; } .exampler-body-header { display: flex; justify-content: space-between; align-items: center; align-self: stretch; } </style>
Disabled state
Use the disabled attribute to disable the tile. A not-available cursor shows when hovering
inside the tile container.
<sl-tile-master disabled> <div slot="body"> <div class="exampler-body-content"> <div class="exampler-body-header"> <span class="body-title">Tile master</span> <sl-tag variant="primary">Clickable</sl-tag> </div> <div class="exampler-body-paragraph"> <span>This is an example of a clickable tile master with sample content. It cannot contain separate interactive elements inside the tile.</span> <span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</span> </div> <div class="exampler-body-action"> <sl-button>Button</sl-button> </div> </div> </div> </sl-tile-master> <style> .exampler-body-content { display: flex; flex-direction: column; align-items: center; flex: 1 0 0; } .exampler-body-header { display: flex; justify-content: space-between; align-items: center; align-self: stretch; } </style>
Multi select and radio (single) select
The multi select variant allows users to select more than one option from a group of select tiles. Multi select tiles can contain multiple internal interactive elements.
The radio select variant allows users to select only one option from a group of radio tiles. Radio tiles can contain multiple internal interactive elements. The radio select can be seen with or without the use of radio box.
To use these two selects, please include the sl-tile-group tag to ensure proper functionality.
** Working on combining sl-radio-group with tile master. The sl-radio-group have different styling compared to tile master **
<sl-radio-group label="Select an option" name="options" value="x"> <sl-tile-master> <div slot="prefix"> <sl-radio value="1">Option 1</sl-radio> </div> <div slot="body">Body slot</div> <div slot="suffix">Suffix slot</div> </sl-tile-master> <sl-tile-master> <div slot="prefix"> <sl-radio value="2">Option 2</sl-radio> </div> <div slot="body">Body slot</div> <div slot="suffix">Suffix slot</div> </sl-tile-master> <sl-tile-master> <div slot="prefix"> <sl-radio value="3">Option 3</sl-radio> </div> <div slot="body">Body slot</div> <div slot="suffix">Suffix slot</div> </sl-tile-master> </sl-radio-group> <style> sl-radio { margin-bottom: 0; font-size: var(--hds-font-application-label-fontSize, 14px); font-style: normal; font-weight: var(--hds-font-application-weight-strong, 500); line-height: normal; } </style>
Hover exception for multi select & radio
Multi select and radio tiles have the same states as clickable variant but hover state does not show a hand pointer cursor for the whole tile. It will respect internal interactive elements when hovering more specifically.
[component-metadata:sl-tile-master]