Skip to content

@bynary.composables.observer.Function.useBreakpoint

github-actions[bot] edited this page Jul 11, 2024 · 3 revisions

@bynary/composables / @bynary/composables/observer / useBreakpoint

Function: useBreakpoint()

useBreakpoint(breakpoint): Signal<boolean>

Creates a signal that tracks whether the given breakpoint matches. Uses the BreakpointObserver under the hood.

Parameters

breakpoint: string

Returns

Signal<boolean>

See

https://material.angular.io/cdk/layout/overview#breakpoint-observer

Examples

const isSmallScreen = useBreakpoint('(max-width: 599px)');

You can also use the predefined breakpoints from Breakpoints:

const isHandset = useBreakpoint(Breakpoints.Handset);
``

@param breakpoint - The breakpoint to match
@returns A signal holding whether the given breakpoint matches

## Defined in

[observer/src/breakpoint.composable.ts:26](https://github.com/bynaryDE/angular-extensions/blob/561225efbb51019451599a0545f4666beb215df3/libs/composables/observer/src/breakpoint.composable.ts#L26)
Clone this wiki locally