LayMeshDocs
中文

Style manual#

Start with style and animation libraries: learn bundled libraries, sources and imports, then explore entries, parameters and composition. One .lay file is enough to begin.

Keep dimensions, anchors, data and placement in .lay, with repeated appearance in a theme. Follow these chapters and use the property reference for details.

This manual describes current source. New offline style libraries and diagnostics require an engine build containing those changes; release notes describe published packages.

Learning path#

  1. Getting started and libraries
  2. Selectors, variables and cascade
  3. Appearance properties and units
  4. Shadows and effects
  5. Compatibility and troubleshooting

Complete projects#

Combine libraries and motion in three worked projects: styled cards, artistic poster, and the recovered complex dashboard. Each includes editable source, themes and real playback.

Complete runnable example#

Full source
style-project.lay
page = canvas(size=(132mm,65mm), stylesheet="style-theme.lcss", background="#f6f7fb")card_size = (30mm,22mm)gap = 9mmlibrary = page.add(rect(size=card_size,class="bg-primary rounded shadow"),                   target=page.top_left,offset=(12mm,12mm))custom = page.add(rect(size=card_size,class="bg-primary rounded shadow custom"),                  target=library.top_right,offset=(gap,0mm))props = page.add(rect(size=card_size,class="card ocean"),                 target=custom.top_right,offset=(gap,0mm))for card,label in [(library,"Library shadow"),(custom,"Blur: 2 mm"),(props,"Open Props")] {  page.add(text(label,class="caption"),target=card.bottom_left,offset=(0mm,gap))}

Preview

Background
Preparing preview…
Style Project
Preparing preview…
Total —
Details

Not run yet

Measured in this browser; excludes debounce.

Edits stay on this page
Dependencies
  • examples/manual/style-project.lay
  • examples/manual/style-theme.lcss

The first card sets its page margin relative to page.top_left. Subsequent cards follow top_right, and each label follows its card's bottom_left. card_size and gap control dimensions and spacing: change width from 30mm to 26mm and the following cards and labels move with their anchors. Themes save appearance, loops remove repetition, and anchors save layout relationships. See placement and loops/functions.

Common questions#

Explicit .lay parameters override LCSS, including important declarations. Omit the matching object parameter when the theme should control it; see cascade. Change only blur to 2mm with partial overrides.

Previous section links

Loading and precedence#

Read the chapter

Paints and borders#

Read the chapter

Resources and limits#

Read the chapter

style-properties#

Read the chapter

css-libraries#

Read the chapter

shadow-overrides#

Read the chapter

css-units#

Read the chapter

css-effects#

Read the chapter

css-compatibility#

Read the chapter

workflow#

Read the chapter