Skip to content

feat: MD3 elevation levels#22461

Merged
J-Sek merged 9 commits intonextfrom
feat/md3-elevation
Jan 28, 2026
Merged

feat: MD3 elevation levels#22461
J-Sek merged 9 commits intonextfrom
feat/md3-elevation

Conversation

@J-Sek
Copy link
Copy Markdown
Contributor

@J-Sek J-Sek commented Dec 19, 2025


  • reduces levels to 6
  • adds support to control color (shadow tint) from theme variables
  • adds .elevation-overlay class meant to help with dark mode

Post-implementation tasks:

  • migration guide
  • migrate docs examples and docs components
  • migrate general components and tests
  • update regular docs
  • fix bugs
  • FABs should have higher elevation

resolves #14198

Markup:

<template>
  <v-app>
    <v-main>
      <v-container max-width="1200">
        <v-sheet :color="panelColor" class="pa-12">
          <v-row justify="center">
            <v-col v-for="(_, n) in 6" :key="n" class="pa-2" cols="auto">
              <v-card
                :class="[
                  'd-flex justify-center align-center',
                  `elevation-${n}`,
                  { 'elevation-overlay': elevationOverlay },
                ]"
                :color="cardColor"
                height="120"
                rounded="xl"
                theme="light"
                width="120"
              >
                <div>{{ n }}</div>
              </v-card>
            </v-col>
          </v-row>
          <v-row v-for="(_, b) in 5" :key="b" justify="center">
            <v-col
              v-for="(_, n) in 6"
              :key="n"
              class="pa-2"
              cols="auto"
              style="width: calc(1px * (120 + 4 * 2 * 2))"
            >
              <v-hover v-slot="{ props: hoverProps, isHovering }">
                <v-card
                  v-if="n > b"
                  v-bind="hoverProps"
                  :class="[
                    'd-flex justify-center align-center',
                    `elevation-${isHovering ? n : b}`,
                    { 'elevation-overlay': elevationOverlay },
                  ]"
                  :color="cardColor"
                  height="120"
                  rounded="xl"
                  theme="light"
                  width="120"
                >
                  <div>{{ b }} » {{ n }}</div>
                </v-card>
              </v-hover>
            </v-col>
          </v-row>
        </v-sheet>
      </v-container>
    </v-main>
    <v-fab
      :color="panelColor"
      location="top end"
      prepend-icon="$color"
      rounded="pill"
      app
    >
      Panel color
      <v-icon />
      <v-menu activator="parent">
        <v-color-picker v-model="panelColor" />
      </v-menu>
    </v-fab>
    <v-fab
      :color="cardColor"
      location="top end"
      prepend-icon="$color"
      rounded="pill"
      style="margin-top: 45px"
      app
    >
      Card color
      <v-menu activator="parent">
        <v-color-picker v-model="cardColor" />
      </v-menu>
    </v-fab>
    <v-fab
      :color="shadowColor"
      location="top end"
      prepend-icon="$color"
      rounded="pill"
      style="margin-top: 90px"
      app
    >
      Shadow color
      <v-menu activator="parent">
        <v-color-picker v-model="shadowColor" />
      </v-menu>
    </v-fab>
    <v-fab
      :append-icon="elevationOverlay ? '$checkboxOn' : '$checkboxOff'"
      location="top end"
      rounded="pill"
      style="margin-top: 135px"
      app
      @click="elevationOverlay = !elevationOverlay"
    >
      Overlay
    </v-fab>
  </v-app>
</template>

<script setup lang="ts">
  import { shallowRef, watch } from 'vue'
  import { useTheme } from 'vuetify'
  const panelColor = shallowRef('#fdfbfe')
  const cardColor = shallowRef('#e1dff8')
  const shadowColor = shallowRef('#000')
  const elevationOverlay = shallowRef(false)

  const { global, themes } = useTheme()
  watch(shadowColor, v => {
    themes.value[global.name.value].variables['shadow-color'] = v
  })
</script>

@J-Sek J-Sek self-assigned this Dec 19, 2025
@J-Sek J-Sek added E: elevation Elevation composable MD3 labels Dec 19, 2025
@J-Sek J-Sek marked this pull request as draft December 19, 2025 17:09
@J-Sek J-Sek linked an issue Dec 19, 2025 that may be closed by this pull request
@J-Sek J-Sek force-pushed the feat/md3-elevation branch 4 times, most recently from 4613cae to f570094 Compare December 21, 2025 01:04
@J-Sek J-Sek marked this pull request as ready for review December 21, 2025 01:04
@J-Sek J-Sek force-pushed the feat/md3-elevation branch 3 times, most recently from 4e8d329 to cd08fdf Compare December 22, 2025 23:24
@KaelWD
Copy link
Copy Markdown
Member

KaelWD commented Dec 23, 2025

Does not address the main point of #14198 (changing surface color in dark theme). I think this was one of the original goals for the __underlay element to avoid setting background-color on the component itself.
M3 is as usual really inconsistent with this though - there's no guidelines for how a surface should change with elevation, and elevation can be expressed with contrasting colors or a scrim instead of shadows.

@J-Sek J-Sek force-pushed the feat/md3-elevation branch from cd08fdf to a80f7f3 Compare January 26, 2026 05:39
@J-Sek
Copy link
Copy Markdown
Contributor Author

J-Sek commented Jan 26, 2026

I am experimenting with elevation-overlay that would work well for dark mode. Similar trick as in MUI. Requires opt-in by adding CSS class.

@J-Sek J-Sek force-pushed the feat/md3-elevation branch from d1661f7 to 4cbf812 Compare January 27, 2026 23:08
@J-Sek J-Sek changed the title feat: support MD3 elevation levels feat: MD3 elevation levels Jan 28, 2026
@J-Sek J-Sek merged commit dfce695 into next Jan 28, 2026
16 checks passed
@J-Sek J-Sek deleted the feat/md3-elevation branch January 28, 2026 18:17
@KaelWD KaelWD added this to the v4.0.0 (Revisionist) milestone Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

E: elevation Elevation composable MD3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Elevation levels in dark mode improvement

2 participants