Skip to main content

context.svelte

Documentation / lib/components/ui/sidebar/context.svelte

IsMobile​

Defined in: apps/web/src/lib/components/ui/sidebar/context.svelte.ts:10

Extends​

  • MediaQuery

Constructors​

Constructor​

new IsMobile(breakpoint: number): IsMobile;

Defined in: apps/web/src/lib/components/ui/sidebar/context.svelte.ts:11

Parameters​
ParameterTypeDefault value

breakpoint

number

DEFAULT_MOBILE_BREAKPOINT

Returns​

IsMobile

Overrides​
MediaQuery.constructor

SidebarStateProps​

type SidebarStateProps = object;

Defined in: apps/web/src/lib/components/ui/sidebar/context.svelte.ts:16

Properties​

open​

open: Getter<boolean>;

Defined in: apps/web/src/lib/components/ui/sidebar/context.svelte.ts:22

A getter function that returns the current open state of the sidebar. We use a getter function here to support bind:open on the Sidebar.Provider component.

setOpen()​

setOpen: (open: boolean) => void;

Defined in: apps/web/src/lib/components/ui/sidebar/context.svelte.ts:29

A function that sets the open state of the sidebar. To support bind:open, we need a source of truth for changing the open state to ensure it will be synced throughout the sub-components and any bind: references.

Parameters​
ParameterType

open

boolean

Returns​

void


setSidebar()​

function setSidebar(props: SidebarStateProps): SidebarState;

Defined in: apps/web/src/lib/components/ui/sidebar/context.svelte.ts:79

Instantiates a new SidebarState instance and sets it in the context.

Parameters​

ParameterTypeDescription

props

SidebarStateProps

The constructor props for the SidebarState class.

Returns​

SidebarState

The SidebarState instance.


useSidebar()​

function useSidebar(): SidebarState;

Defined in: apps/web/src/lib/components/ui/sidebar/context.svelte.ts:88

Retrieves the SidebarState instance from the context. This is a class instance, so you cannot destructure it.

Returns​

SidebarState

The SidebarState instance.