Skip to content

Conversation

@J-Sek
Copy link
Contributor

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


  • reduces levels to 6
  • adds support to control color (shadow tint) from theme variables

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="1000">
        <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}`]"
                :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}`]"
                  :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-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 { current } = useTheme()
  watch(shadowColor, v => {
    current.value.variables['theme-shadow'] = [
      parseInt(v.substring(1, 3), 16),
      parseInt(v.substring(3, 5), 16),
      parseInt(v.substring(5, 7), 16),
    ].join(',')
  })
</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 2 times, most recently from af0cfb7 to 4e8d329 Compare December 22, 2025 22:52
'feat/md3-elevation' on '71e01aaee'.
'feat/md3-elevation' on '96b9cf79a'.
packages/docs/src/pages/en/getting-started/elevation-migration.md
packages/docs/src/pages/en/getting-started/upgrade-guide.md
@J-Sek J-Sek force-pushed the feat/md3-elevation branch from 4e8d329 to cd08fdf Compare December 22, 2025 23:24
@KaelWD
Copy link
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.

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