Skip to content

Commit

Permalink
feat(display): add explicit prop that overrides mobile state
Browse files Browse the repository at this point in the history
  • Loading branch information
johnleider committed Apr 27, 2024
1 parent e9d132f commit fafc39f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/vuetify/src/composables/display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export type DisplayThresholds = {
}

export interface DisplayProps {
mobile?: boolean | null
mobileBreakpoint?: number | DisplayBreakpoint
}

Expand Down Expand Up @@ -214,6 +215,10 @@ export function createDisplay (options?: DisplayOptions, ssr?: SSROptions): Disp
}

export const makeDisplayProps = propsFactory({
mobile: {
type: Boolean,
default: null,
},
mobileBreakpoint: [Number, String] as PropType<number | DisplayBreakpoint>,
}, 'display')

Expand All @@ -226,6 +231,7 @@ export function useDisplay (
if (!display) throw new Error('Could not find Vuetify display injection')

const mobile = computed(() => {
if (props.mobile != null) return props.mobile
if (!props.mobileBreakpoint) return display.mobile.value

const breakpointValue = typeof props.mobileBreakpoint === 'number'
Expand Down

0 comments on commit fafc39f

Please sign in to comment.