<tap-stack>

Stack navigation like iOS. Pushed pages slide in from the right, and swipe right from the left edge to close. Pages are pushed into the history stack by default, so the back button of the browser or system also closes them.

Example

import { Stack } from '@mantou/tap-ui/elements/stack';

// Push a page to the global root stack
Stack.push({
  content: html`<my-detail-page></my-detail-page>`,
});

// Close the top page
Stack.pop();

Use the closest stack in an element, e.g. a stack inside a sheet:

Stack.getClosestStack(this)?.push({ content: html`<my-profile-page></my-profile-page>` });

API

Extends GemElement

Static Properties

Property Type
instance TapStackElement | undefined

Static Methods

Method Type
push (options: StackPushOptions) => void
replace (options: StackPushOptions, replaceOptions?: StackReplaceOptions) => void
pop (options?: StackPopOptions) => void
inCurrentStack (ele: HTMLElement) => boolean
getClosestStack (ele?: Element) => TapStackElement | undefined

Instance Properties

Property(Attribute) Reactive Type Description
disableHistory(disable-history) Yes boolean
autoHeight(auto-height) Yes boolean
maxHeight(max-height) Yes number
rootClose Emitter<null> Closing the root page: pop() with only the root page left, or swiping back on it; the root page stays, and nothing is below it, so it doesn't follow the finger
get store ((value?: Partial<{ pages: StackPushOptions[]; offset: number; sheetProgress: number; }> | undefined) => void) & Omit<{ [Symbol.metadata]: never; name: never; apply: never; call: never; ... 6 more ...; [Symbol.hasInstance]: never; }, "offset" | ... 1 more ... | "sheetProgress"> & ...

Instance Methods

Method Type
push (options: StackPushOptions) => void
replace (options: StackPushOptions, { keep }?: StackReplaceOptions) => void
pop (options?: StackPopOptions) => void

Other

Type Value
Event root-close