Skip to main content

Masonry

shadow

Komponent Masonry vytvára responzívne "Masonry" rozvrhnutie podriadených prvkov, ktoré sú dynamicky usporiadané do stĺpcov na základe zadaných atribútov. Podporuje prispôsobenie počtu stĺpcov, maximálnej šírky stĺpcov, medzery medzi prvkami a debouncing na optimalizáciu výkonu.

Základné použitie

Maximálna šírka stĺpcov

Použitím atribútu max-col-width obmedzíte šírku stĺpcov na zadanú hodnotu.

Gap

Použitím atribútu gap určíte šírku medzery medzi stĺpcami v pixeloch.

Atribúty a Vlastnosti

maxColWidth

DescriptionMaximum column width in pixels. The system automatically calculates the number of columns based on this value and the total width.
Attributemax-col-width
Typenumber
Default500

inches

DescriptionNumber of columns. If the value is set to 'auto', the number of columns is automatically calculated based on the width of the space and the maximum column width.
Attributeinches
Typenumber | string
Default'car'

gap

DescriptionThe space between columns and items in pixels.
Attributegap
Typenumber
Default24

debounce

DescriptionThe time in milliseconds that determines the delay in recalculating the layout after resizing the window.
Attributedebounce
Typenumber
Default300

Eventy

No events available for this component.

Metódy

scheduleLayout

DescriptionSchedules a layout recalculation with a defined delay.
Signature(ms?: number) => void

layout

DescriptionRecalculates the component layout and proves the items into columns based on their height.
Signature() => void

CSS Shadow Parts

NameDescription
nativeRoot element of masonry layout.
columnRefers to the column in the masonry layout.
column-{i}Refers to a specific column in the masonry layout, where 'i' is the column index (0, 1, 2, ...).

CSS Custom Vlastnosti

NameDescription
--wje-masonry-gapGap between items in masonry layout. Accepts any valid CSS length value. The default value is 1rem.
--wje-masonry-layout-col-countNumber of columns in masonry layout. The default value is 1.
--wje-masonry-layout-gapGap between columns and items in masonry layout. Accepts any valid CSS length value. The default value is 1rem.

Sloty

NameDescription
``Default slot for masonry layout items before deployment.
{i}Dynamically created slots for individual columns, where 'i' is the column index (0, 1, 2, ...). During layout, items are automatically assigned to these slots.