import { KbqSidebarModule } from '@koobiq/components/sidebar';@Component({ selector: 'kbq-sidebar', exportAs: 'kbqSidebar' })
class KbqSidebar {
opened = input<boolean | undefined>();
readonly position = input<SidebarPositions>();
readonly stateChanged = output<boolean>();
get hasSavedState(): boolean;
saveState(): void;
clearSavedState(): void;
toggle(): void;
}useStateSavingboolean Whether the component remembers its state across reloads and restores it on the next render.
Defaults to true, or to whatever KBQ_STATE_SAVING_ENABLED is provided as.
stateSavingKeystring The key the state is persisted under. While it is empty the key is derived from where the
component sits in the document, which moves when the surrounding markup is restructured — an id
on the component or any ancestor pins it just as well as this input does.
hasSavedStateboolean Whether state is currently persisted for this sidebar — restored on init, or written since.
Always false while useStateSaving is unset, and false again after clearSavedState().
saveState()void Persists whether the sidebar is open and the width it was last left at.
Called whenever opened changes. The width is only captured as the sidebar closes, so dragging it
wider and reloading without closing it keeps the previous width — the same as before persistence.
clearSavedState()void Removes the state persisted for this sidebar.
Persistence itself stays on — the next change is written again. Unset useStateSaving to stop it.
@Directive({ selector: '[kbq-sidebar-closed]', exportAs: 'kbqSidebarClosed' })
class KbqSidebarClosed {
readonly width = input<string>();
}@Directive({ selector: '[kbq-sidebar-opened]', exportAs: 'kbqSidebarOpened' })
class KbqSidebarOpened {
readonly minWidth = input<string>();
readonly width = input<string>();
readonly maxWidth = input<string>();
}The persisted state of a sidebar — whether it was open, and the width it was last left at.
interface KbqSidebarState {
opened: boolean;
width?: string;
}widthstring Absent while the sidebar has never been resized away from the width its content declares.
enum SidebarPositions {
Left = 'left',
Right = 'right'
}