The Tile component provides a versatile way to create interactive, animated tiles in various sizes with different effects. Tiles can be used to create a Windows-style tile interface or any grid-based layout with interactive elements.
< div data-role = "tile" ></ div >
< div data-role = "tile" data-size = "wide" data-effect = "slide-up" ></ div >
< span class = "mif-facebook icon" ></ span >
< span class = "branding-bar" > Facebook </ span >
< div data-role = "tile" class = "bg-red" >
< span class = "badge-top" > 10 </ span >
< span class = "badge-bottom" > 5 </ span >
< div data-role = "tile" data-size = "small" > Tile 1 </ div >
< div data-role = "tile" data-size = "medium" > Tile 2 </ div >
< div data-role = "tile" data-size = "wide" > Tile 3 </ div >
< div data-role = "tile" data-size = "large" > Tile 4 </ div >
< div data-role = "tile" data-effect = "slide-up" data-size = "wide" >
< div class = "slide" data-cover = "./images/image1.jpg" ></ div >
< div class = "slide" data-cover = "./images/image2.jpg" ></ div >
< div class = "slide" data-cover = "./images/image3.jpg" ></ div >
< div data-role = "tile" data-size = "wide" data-effect = "image-set" >
< img src = "./images/image1.jpg" alt = "" >
< img src = "./images/image2.jpg" alt = "" >
< img src = "./images/image3.jpg" alt = "" >
< img src = "./images/image4.jpg" alt = "" >
< img src = "./images/image5.jpg" alt = "" >
< div data-role = "tile" class = "effect-hover-slide-up" >
< div class = "slide-front" data-cover = "./images/image1.jpg" ></ div >
< div class = "slide-back" data-cover = "./images/image2.jpg" ></ div >
Parameter Type Default Description tileDeferrednumber 0 Delay before initialization sizestring ”medium” Size of the tile. Possible values: “small”, “medium”, “wide”, “large”, “app” coverstring "" URL to the background image coverPositionstring ”center” Position of the background image effectstring "" Animation effect for the tile. Possible values: “slide-up”, “slide-down”, “slide-left”, “slide-right”, “fade”, “zoom”, “swirl”, “switch”, “image-set” effectIntervalnumber 3000 Interval between animation effects in milliseconds effectDurationnumber 500 Duration of the animation effect in milliseconds targetstring null URL to navigate to when the tile is clicked canTransformboolean true Whether the tile can transform when clicked onTileClickfunction Metro.noop Callback function when the tile is clicked onTileCreatefunction Metro.noop Callback function when the tile is created
_runEffects() - Starts the animation effects for the tile
_stopEffects() - Stops the animation effects for the tile
_setCover(element, src, position) - Sets the background image for the tile
destroy() - Removes the tile and its event handlers
const tile = Metro . getPlugin ( '#myTile' , 'tile' );
Event Description onTileClickTriggered when the tile is clicked onTileCreateTriggered when the tile is created
Variable Default (Light) Dark Mode Description --tile-background#ededed #26282e Background color of the tile --tile-color#191919 #ffffff Text color of the tile --tile-border-colorvar(—border-color) var(—border-color) Border color of the tile --tile-border-radius6px 6px Border radius of the tile --tile-badge-backgroundrgba(25, 25, 25, 0.1) rgba(25, 25, 25, 0.1) Background color of the badge --tile-badge-color#191919 #ffffff Text color of the badge --tile-grid-gap10px 10px Gap between tiles in a grid
--tile-background : #3498db ;
--tile-border-radius : 10 px ;
.tile-small - Small tile (70px x 70px)
.tile-medium - Medium tile (150px x 150px)
.tile-wide - Wide tile (310px x 150px)
.tile-large - Large tile (310px x 310px)
.tile-app - App tile (44px x 44px)
.icon - Icon inside the tile
.branding-bar - Bar at the bottom of the tile
.badge-top - Badge at the top right of the tile
.badge-bottom - Badge at the bottom right of the tile
.slide - Slide for animation effects
.slide-front - Front slide for hover effects
.slide-back - Back slide for hover effects
.transform-right - Transformation effect when clicked on the right side
.transform-left - Transformation effect when clicked on the left side
.transform-top - Transformation effect when clicked on the top side
.transform-bottom - Transformation effect when clicked on the bottom side
.effect-hover-slide-up - Slide up effect on hover
.effect-hover-slide-down - Slide down effect on hover
.effect-hover-slide-left - Slide left effect on hover
.effect-hover-slide-right - Slide right effect on hover
.effect-hover-zoom-up - Zoom up effect on hover
.effect-hover-zoom-down - Zoom down effect on hover
.effect-hover-zoom-left - Zoom left effect on hover
.effect-hover-zoom-right - Zoom right effect on hover
.image-set - Special effect for displaying multiple images in a tile
.tiles-grid - Grid layout for tiles
.tiles-group - Group of tiles with a title