useDisplay
Commons
stable
Reactive display breakpoint detection. Returns the current viewport breakpoints, platform info, and a component-scoped mobile class. Must be consumed inside an app that has called createDisplay() during plugin setup.
API
Signature
Full TypeScript signature sourced from the composable file.
Consumed interfaces
IDisplayProps
IDisplayInstance
IDisplayOptions
API
Parameters
Input parameters accepted by this composable.
- propsIDisplayProps{}
- Optional props object containing mobileBreakpoint. When provided, overrides the global mobileBreakpoint threshold for this component instance.
- namestringgetCurrentInstanceName()
- Component name used to generate the scoped mobile CSS class (e.g. "my-component--mobile"). Defaults to the current Vue instance name.
API
Return values
Properties and methods exposed by the composable return object.
- xs / sm / md / lg / xl / xxl
- Boolean refs indicating whether the current viewport matches each named breakpoint exactly.
- smAndUp / mdAndUp / lgAndUp / xlAndUp
- True when the viewport is at or above the named breakpoint.
- smAndDown / mdAndDown / lgAndDown / xlAndDown
- True when the viewport is at or below the named breakpoint.
- mobile
- True when the viewport width is below the resolved mobileBreakpoint threshold (global or instance-level).
- displayClasses
- Class map to bind on the component root. Adds `{name}--mobile` when mobile is true.
- width / height
- Current viewport width and height in pixels, updated on window resize.
- platform
- Platform detection object with boolean flags for android, ios, chrome, firefox, win, mac, touch, ssr, etc.
- thresholds
- Resolved pixel thresholds for each breakpoint (sm, md, lg, xl, xxl).
- name
- The active breakpoint name as a string: "xs", "sm", "md", "lg", "xl" or "xxl".
Usage
Examples
Ready-to-paste usage snippets.
Conditional rendering by breakpoint
Custom mobileBreakpoint per component