Skip to content
LIBRARYBase

Icon ​

m-icon · A symbol from the Lucide set that follows the theme. Renders the bundled icon font on iOS, Android and the Web.

Web preview
Open example ↗

Usage ​

vue
<m-row gap="sm" align="center">
  <m-icon name="search" tone="muted" />
  <m-text>Search</m-text>
</m-row>
<m-icon name="circle-check" tone="success" label="Done" />

Register the components through the alpha installation guide. The API remains experimental.

Install the font ​

NativeScript loads custom fonts from the app's fonts folder. Copy the bundled file once (use src/fonts/ when appPath is src):

sh
cp node_modules/@getcortexlabs/mavis/fonts/lucide.ttf app/fonts/

Webpack apps can copy it at build time instead, as the catalog does:

js
webpack.Utils.addCopyRule({
  from: 'lucide.ttf',
  to: 'fonts',
  context: 'node_modules/@getcortexlabs/mavis/fonts',
})

The Web stylesheet declares the @font-face and loads lucide.woff2 from the package; importing @getcortexlabs/mavis-web/style.css is enough.

API ​

PropTypeDefaultPurpose
nameIconNamerequiredLucide icon name, such as search or circle-check. Unknown names throw RangeError.
sizesm | md | lg | numbermd16, 20 or 24 points, or any positive number.
tonepalette colortextTheme color, such as primary, muted or danger.
labelstringnoneAccessible name. Without it the icon is decorative and hidden from assistive technology.
idstringnoneIdentifies the rendered icon.
systemNamestringnoneiOS SF Symbol artwork; name stays the portable fallback.
motionSurfaceMotionSurfacenoneExperimental surface for symbolEffect().
replacebooleanfalseWith a motionSurface, a change of name or iOS systemName plays Jolt's symbol replacement. Can change while mounted.

class, style and undeclared attributes apply to the rendered glyph. No default slot is consumed. The IconName type from @getcortexlabs/mavis-core lists the 1998 canonical names of Lucide 1.65.0; aliases are not included. Browse the set at lucide.dev/icons.

Accessibility and alignment ​

Icons are decorative by default: screen readers skip them, so pair them with text that carries the meaning. Give label only to icons that stand alone, such as a status mark; it becomes the image name on both platforms. Icons keep their size in rows (shrink is 0) and center vertically next to text. Button takes icon and trailingIcon, and an icon-only button needs accessibilityLabel; Input draws icon and trailingIcon inside the editor box. Both use the bundled font and the same names.

Replacement ​

With replace and a motionSurface, a change of name plays a symbol replacement instead of an instant swap: a decorative layer on Web, the SF Symbol content transition for systemName on iOS, an immediate swap on Android and for glyphs. The name and label are yours and change at once; the artwork always ends on the current name, after rapid changes, cancellation and reduced motion. See icon replacement and the Glyph showcase.

Glyph toggles notifications, rings the bell and changes the Like button. The screen owns the accessible name and button state. Changing replace affects the next artwork swap on the mounted icon.

iPhone 17 Pro simulator, iOS 26.2. The catalog probe activates the native controls. The bell uses an SF Symbol.

Android API 36 emulator. The catalog probe activates native controls. The Lucide glyph swaps immediately and the Like button reflects the action.

Chromium. Mouse clicks change the glyph and activate the effect on its decorative layer.

Bundle and license ​

The native package ships fonts/lucide.ttf (0.97 MB) and the Web package src/fonts/lucide.woff2 (309 KB), both with the full set and the ISC license next to them. Subsetting to the icons an app uses is future work.

Full example ​

This file also runs in the NativeScript catalog and the Web preview.

View source
vue
<script setup lang="ts">
import { useCatalogLocale } from '../locale'
import { computed, markRaw, ref } from 'vue'
import { createMotionSurface } from '@getcortexlabs/mavis-core/experimental'

const { t, locale } = useCatalogLocale(() => props.lang)

const props = withDefaults(defineProps<{ lang?: 'en' | 'pt' }>(), { lang: undefined })

const pt = computed(() => (props.lang ?? locale.value) === 'pt')
const names = ['search', 'heart', 'bell', 'settings', 'camera', 'map-pin', 'sun', 'moon'] as const
const night = ref(false)
const sky = markRaw(createMotionSurface())
</script>

<template>
  <m-column gap="lg">
    <m-row gap="md" wrap>
      <m-icon
        v-for="name in names"
        :key="name"
        :name="name"
        size="lg"
        tone="primary"
        :label="t(name)"
      />
    </m-row>
    <m-row gap="sm" align="center">
      <m-icon name="search" tone="muted" />
      <m-text>{{ t(pt ? 'Buscar' : 'Search') }}</m-text>
    </m-row>
    <m-row gap="md" align="center">
      <m-icon name="star" size="sm" tone="accent" />
      <m-icon name="star" tone="accent" />
      <m-icon name="star" size="lg" tone="accent" />
      <m-icon name="star" :size="32" tone="accent" />
      <m-text variant="caption" tone="muted">{{ t('sm · md · lg · 32') }}</m-text>
    </m-row>
    <m-card padding="md" gap="sm">
      <m-row gap="sm" align="center">
        <m-icon name="circle-check" tone="success" :label="t(pt ? 'Concluído' : 'Done')" />
        <m-text>{{ t(pt ? 'Sessão salva.' : 'Session saved.') }}</m-text>
      </m-row>
      <m-row gap="sm" align="center">
        <m-icon name="triangle-alert" tone="danger" :label="t(pt ? 'Atenção' : 'Warning')" />
        <m-text>{{ t(pt ? 'Confira o e-mail.' : 'Check the email.') }}</m-text>
      </m-row>
      <m-row gap="sm" align="center">
        <m-icon name="info" tone="muted" />
        <m-text variant="caption" tone="muted">{{
          t(pt ? 'Sem label, o ícone é decorativo.' : 'Without a label, the icon is decorative.')
        }}</m-text>
      </m-row>
    </m-card>
    <m-row gap="md" align="center">
      <m-icon
        id="icon-demo-sky"
        :name="night ? 'moon' : 'sun'"
        :systemName="night ? 'moon.stars.fill' : 'sun.max.fill'"
        replace
        :motionSurface="sky"
        :size="32"
        tone="primary"
        :label="night ? (pt ? 'Noite' : 'Night') : pt ? 'Dia' : 'Day'"
      />
      <m-button id="icon-demo-switch" size="sm" variant="secondary" @click="night = !night">{{
        night ? (pt ? 'Amanhecer' : 'Sunrise') : pt ? 'Anoitecer' : 'Nightfall'
      }}</m-button>
    </m-row>
  </m-column>
</template>

In context ​

See the components in a complete vehicle controls screen.

Experimental image, icon, Sheet and Dialog integrations are described in Images and physics. They require Jolt RC.11 and are included in Mavis alpha.8.

Components for NativeScript and Web. Starting with Vue.