diff --git a/docs/components/local-nav.md b/docs/components/local-nav.md index 0387542b..658cf24e 100644 --- a/docs/components/local-nav.md +++ b/docs/components/local-nav.md @@ -43,6 +43,27 @@ const title = [ ``` +### Page actions + +You may define `:actions` to display page actions (buttons). The `:actions` prop accepts array of [`Action`](#action) object. The action object is the same as props for [``](button) except `:size` since the size is fixed to `small`, and an extra `onClick` function to handle the click event. + +```vue + + + +``` + ### Page navigation You may define `:menu` to display a page navigation. The `:menu` props accepts "double nested" array, in order to create grouping of menu items. @@ -94,6 +115,30 @@ interface Title { } ``` +### `Action` + +```ts +import { type Component } from 'vue' +import { type Mode, type Tooltip, type Type } from '@globalbrain/sefirot/lib/components/SButton.vue' + +export interface Action { + tag?: string + type?: Type + mode?: Mode + icon?: Component + leadIcon?: Component + trailIcon?: Component + iconMode?: Mode + label?: string + labelMode?: Mode + href?: string + loading?: boolean + disabled?: boolean + tooltip?: string | Tooltip + onClick?(): void +} +``` + ### `MenuItem` The type of menu item. @@ -114,6 +159,7 @@ interface Props { avatar?: Avatar title: Title[] description?: string + actions?: Action[] menu?: MenuItem[][] } ``` @@ -149,7 +195,7 @@ interface Props { /> ``` -### `description` +### `:description` Add description text under the title. @@ -166,6 +212,26 @@ interface Props { /> ``` +### `:actions` + +The actions of the page. + +```ts +interface Props { + actions: Action[] +} +``` + +```vue-html + +``` + ### `:menu` The menu of the page. @@ -179,9 +245,9 @@ interface Props { ```vue-html ``` diff --git a/lib/components/SLocalNav.vue b/lib/components/SLocalNav.vue index ac3e9ccc..e98d62c0 100644 --- a/lib/components/SLocalNav.vue +++ b/lib/components/SLocalNav.vue @@ -1,11 +1,12 @@ + + + + diff --git a/lib/components/SLocalNavTitle.vue b/lib/components/SLocalNavTitle.vue index e8b82145..d38e7972 100644 --- a/lib/components/SLocalNavTitle.vue +++ b/lib/components/SLocalNavTitle.vue @@ -24,6 +24,8 @@ defineProps<{