Skip to content

Tile

Tile

Simple tile implementation.

html
<six-tile id="tileFancy" label="Fancy Tile" icon-name="favorite"></six-tile>
<script type="module">
  const tile = document.querySelector('#tileFancy');
  tile.addEventListener('six-tile-selected', () => alert('hello fancy tile!'));
</script>

Examples

Sizes

Use the size attribute to change the size of the tile.

html
<six-tile label="Small" icon-name="home" size="small"></six-tile>
<six-tile label="Medium" icon-name="home"></six-tile>
<six-tile label="Large" icon-name="home" size="large"></six-tile>

Closeable

Use the closeable attribute to avoid that the tile is closable.

html
<six-tile label="Medium" icon-name="home" closeable="false"></six-tile>

Elevated

Use the elevated attribute to let the tile cast a shadow.

html
<six-tile label="Medium" icon-name="home" elevated="true"></six-tile>

Disabled

Use the disabled attribute to avoid that the tile is clicked.

html
<six-tile label="Medium" icon-name="home" disabled="true"></six-tile>

Passing props via slot

In some cases you might need to have more control over how the icon or label is displayed. In these scenarios use the slot over the props.

some very long label
which requires
multiple lines
delete
short label
html
<six-tile id="tileWithLabelSlot" icon-name="home">
  <div slot="label" style="text-align: center; min-height: 4em">
    <div>some very long label</div>
    <div>which requires</div>
    <div>multiple lines</div>
  </div>
</six-tile>
<six-tile id="tileWithIconSlot" sixTileSelected="alert('clicked')">
  <six-icon slot="icon" size="xxLarge" style="color: red">delete</six-icon>
  <div slot="label" style="text-align: center; min-height: 4em; align-items: center; display: flex">
    short label
  </div>
</six-tile>
<script type="module">
  const tile1 = document.querySelector('#tileWithIconSlot');
  tile1.addEventListener('six-tile-selected', () => alert('hello custom icon tile!'));

  const tile2 = document.querySelector('#tileWithLabelSlot');
  tile2.addEventListener('six-tile-selected', () => alert('hello custom label tile!'));
</script>

Adding a tooltip

If you wish to show a tooltip on hover, simply add the attribute disable-tooltip="false"

html
<six-tile label="Fancy Tile" icon-name="favorite" disable-tooltip="false"></six-tile>

Properties

PropertyAttributeDescriptionTypeDefault
closeablecloseableFlag, whether the tile is closeable.booleantrue
disableTooltipdisable-tooltipEnables tile tooltip for tilesbooleantrue
disableddisabledSet to true to disable the tile.booleanfalse
elevatedelevatedFlag, whether the tile should cast a shadow.booleanfalse
iconNameicon-nameThe icon's name.string | undefinedundefined
labellabelThe tile's label.string''
sizesizeThe tile's size."large" | "medium" | "small"'medium'

Events

EventDescriptionType
six-tile-closedEmitted when the tile was closed.CustomEvent<undefined>
six-tile-selectedEmitted when the tile is selected.CustomEvent<undefined>

Methods

hide() => Promise<void>

Hides the tile

Returns

Type: Promise<void>

show() => Promise<void>

Shows the tile

Returns

Type: Promise<void>

Shadow Parts

PartDescription
"base"
"body"
"footer"
"header"

Dependencies

Depends on

Graph


Copyright © 2021-present SIX-Group