Vehicle controls
A composition with range, climate, charging preferences and access to details. The same Vue screens and state run in the native app and in the browser.
Two themes
Screenshots of the native Android example in Midnight and Mavis.


How it is composed
| Screen area | Components |
|---|---|
| Structure and scrolling | Screen, Column, Row |
| Range and battery | Text, Box |
| Climate and charge limit | Card, Slider |
| Actions and states | Button |
| Additional preferences | Reveal |
shared/context.ts keeps local values and receives a navigation interface. The native app provides vue-router-ns; Web provides Vue Router. Components use the same theme while rendering platform-specific controls.
Screen source
View Vehicle.vue
vue
<script setup lang="ts">
import { useCatalogLocale } from '../locale'
import { useMavisTheme } from '@getcortexlabs/mavis-core/vue'
import { useCatalog } from '../context'
import ThemeSwitch from '../ThemeSwitch.vue'
const { t } = useCatalogLocale()
const { theme } = useMavisTheme()
const { locked, climate, temperature, preferences, chargeLimit, navigation } = useCatalog()
</script>
<template>
<m-screen scroll>
<m-column padding="lg" gap="lg">
<m-button size="sm" variant="ghost" @click="navigation.back('/showcase')">{{
t('← Showcase')
}}</m-button>
<m-row justify="between">
<m-text variant="overline" tone="muted">{{ t('SHOWCASE / VEÍCULO') }}</m-text>
<ThemeSwitch />
</m-row>
<m-column gap="xs">
<m-text variant="title" as="h1">{{ t('O dia é seu.') }}</m-text>
<m-text tone="muted">{{ t('Tudo pronto para a próxima partida.') }}</m-text>
</m-column>
<m-column gap="sm" paddingY="sm">
<m-row align="end" gap="sm">
<m-text variant="display">328</m-text>
<m-text tone="muted">{{ t('km de autonomia') }}</m-text>
</m-row>
<m-row gap="xs" :accessibilityLabel="t('Bateria em 82 por cento')">
<m-box
v-for="bar in 24"
:key="bar"
:grow="1"
:height="7"
:radius="3"
:backgroundColor="bar <= 20 ? theme.colors.primary : theme.colors.elevated"
/>
</m-row>
<m-row justify="between">
<m-text variant="caption" tone="muted">{{ t('BATERIA · 82%') }}</m-text>
<m-text variant="caption" tone="accent">{{ t('Em boa companhia.') }}</m-text>
</m-row>
</m-column>
<m-card gap="lg">
<m-row justify="between">
<m-text variant="overline" tone="muted">{{ t('SEU ESPAÇO') }}</m-text>
<m-text variant="caption" :tone="climate ? 'accent' : 'muted'">
{{ t(climate ? 'Clima ligado' : 'Clima desligado') }}
</m-text>
</m-row>
<m-column gap="xs" paddingY="sm">
<m-text variant="display" align="center">{{ t(temperature) }}°</m-text>
<m-text align="center" tone="muted">{{ t('Na sua temperatura.') }}</m-text>
</m-column>
<m-column gap="xs">
<m-slider
v-model="temperature"
:min="16"
:max="28"
:step="0.5"
:disabled="!climate"
:label="t('Temperatura da cabine')"
/>
<m-row justify="between">
<m-text variant="caption" tone="muted">16°</m-text>
<m-text variant="caption" tone="muted">28°</m-text>
</m-row>
</m-column>
<m-row gap="sm">
<m-button
:grow="1"
:variant="climate ? 'primary' : 'secondary'"
@click="climate = !climate"
>
{{ t(climate ? 'Desligar clima' : 'Ligar clima') }}
</m-button>
<m-button
variant="secondary"
:accessibilityLabel="t('Preferências de carregamento')"
@click="preferences = !preferences"
>
{{ t(preferences ? 'Fechar' : 'Ajustes') }}
</m-button>
</m-row>
</m-card>
<m-reveal :show="preferences">
<m-card gap="md">
<m-row justify="between">
<m-text variant="heading" as="h2">{{ t('Carga ideal') }}</m-text>
<m-text tone="primary">{{ t(chargeLimit) }}%</m-text>
</m-row>
<m-text variant="caption" tone="muted">{{
t('Defina o limite para a próxima recarga.')
}}</m-text>
<m-slider
v-model="chargeLimit"
:min="50"
:max="100"
:step="5"
:label="t('Limite de carregamento')"
/>
</m-card>
</m-reveal>
<m-row gap="sm">
<m-button :grow="1" variant="secondary" @click="locked = !locked">
{{ t(locked ? 'Destrancar' : 'Trancar') }}
</m-button>
<m-button :grow="1" variant="ghost" @click="navigation.push('/showcase/vehicle/details')">{{
t('Meu veículo ↗')
}}</m-button>
</m-row>
<m-text variant="caption" tone="muted" align="center">
{{ t(locked ? 'Veículo trancado' : 'Veículo destrancado')
}}{{ t(' · Demonstração ') }}</m-text
>
</m-column>
</m-screen>
</template>This example demonstrates composition without connecting to real vehicles. To study an individual API, return to the component catalog.