ModaDocs

Naming Layers

How to name layers in Moda for better semantic output from the MCP server.

The Moda MCP server's transformer uses layer names to determine what each element represents. Well-named layers produce better semantic tags, which leads to better generated code.

How it works

When a layer has a descriptive name, the transformer matches it against a keyword list and assigns the appropriate semantic tag. Layer names take priority over visual heuristics.

For example:

  • A rectangle named cta-button becomes <Button> instead of <Box>
  • A group named nav-bar becomes <Nav> instead of <Section>
  • An image named user-avatar becomes <Avatar> instead of <Image>

Keyword reference

These keywords in layer names trigger specific semantic tags. Keywords are case-insensitive and can appear anywhere in the name (e.g., hero-section, main-hero, my_hero).

Interactive elements

KeywordsSemantic tagExample layer names
button, btn, ctaButtonsubmit-btn, cta-button, primary-cta
input, field, textfield, text-inputTextInputemail-input, search-field, name-textfield
linkLinknav-link, footer-link
checkbox, checkCheckboxagree-checkbox, terms-check
radioRadioplan-radio, option-radio
toggle, switchToggledark-mode-toggle, notifications-switch
dropdown, selectSelectcountry-dropdown, role-select

Layout elements

KeywordsSemantic tagExample layer names
cardCardproduct-card, testimonial-card
sectionSectionhero-section, features-section
headerHeaderpage-header, card-header
footerFooterpage-footer, card-footer
nav, navbar, navigationNavmain-nav, sidebar-nav
sidebarSidebarleft-sidebar, filter-sidebar
modal, dialogModalconfirm-modal, settings-dialog
heroHerohomepage-hero, hero-banner
bannerBannerpromo-banner, notification-banner

Content elements

KeywordsSemantic tagExample layer names
avatarAvataruser-avatar, profile-avatar
badgeBadgestatus-badge, notification-badge
tag, chipTagcategory-tag, filter-chip
iconIconsearch-icon, close-icon
logoImagecompany-logo, brand-logo
divider, separatorDividersection-divider, menu-separator
listListfeature-list, menu-list
tableTablepricing-table, data-table

Naming conventions

Any naming convention works — the transformer matches keywords regardless of format:

  • kebab-case: hero-section, cta-button
  • camelCase: heroSection, ctaButton
  • snake_case: hero_section, cta_button
  • PascalCase: HeroSection, CtaButton
  • Space-separated: Hero Section, CTA Button

What happens without names

When layers don't have descriptive names (e.g., Rectangle 1, Group 3), the transformer falls back to visual heuristics:

  • Text with large font size → Heading
  • Rectangle with text and dark fill → Button
  • Rectangle with thin border and no text → TextInput
  • Small circular image → Avatar
  • Group with background → Card

These heuristics work well for common patterns, but explicit layer names produce more accurate results, especially for non-obvious elements.

Tips

  • Name layers that aren't visually obvious — A subtle text link or a custom checkbox benefits most from naming
  • Use semantic names, not visual descriptionssubmit-button is better than blue-rectangle
  • Name groups and sections — Group-level names like features-section improve the structure of the generated code
  • Be consistent — Pick a naming convention and stick with it across your canvas

On this page