Skip to content

Commit

Permalink
feat: tabs content
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Jul 19, 2023
1 parent 7b95cd4 commit 374469e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
16 changes: 15 additions & 1 deletion docs/components/tabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,24 @@ import { RTabs } from 'roughness'
<RSpace overflow>
<RTable
:columns="['name', 'type', 'default', 'description']"
:rows="['graphics-options', 'model-value', 'reactions', 'tabs', '...']"
:rows="['content', 'graphics-options', 'model-value', 'reactions', 'tabs', '...']"
>
<template #body:*:name="{ row }">{{ row }}</template>
<template #body:content:type>

`boolean`

</template>
<template #body:content:default>

`true`

</template>
<template #body:content:description>
Whether to display the tabs content.
</template>

<template #body:graphics-options:type>

`import('roughjs/bin/core').Options`
Expand Down
4 changes: 3 additions & 1 deletion src/tabs/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ defineOptions({
})
const {
content = true,
modelValue,
tabs,
reactions,
graphicsOptions,
} = defineProps<{
content?: boolean,
modelValue?: Tab | undefined,
tabs: T,
} & GraphicsProps>()
Expand Down Expand Up @@ -81,7 +83,7 @@ function activate(tab: Tab) {
</slot>
</RTabAnchor>
</RSpace>
<div class="r-tabs__content" role="tabpanel" aria-expanded="true">
<div v-if="content" class="r-tabs__content" role="tabpanel" aria-expanded="true">
<slot v-if="internalModelValue" :name="`content:${internalModelValue}`" :tab="(internalModelValue as Tab)">
<slot name="content:*" :tab="(internalModelValue as Tab)"></slot>
</slot>
Expand Down

0 comments on commit 374469e

Please sign in to comment.