Divided StackCommunity Asset
<script setup lang="ts">
const range = ref('7')
const toggleVisibility = ref(true)
</script>
<template>
<div class="n-stack n-gap-l">
<DividedStack>
<!-- Web components -->
<nord-banner>
<p class="n-padding-be-s">
Use the toggle below to see how the dividers are reactively added and
removed.
</p>
<nord-tag
size="s"
variant="selectable"
:checked="toggleVisibility"
@change="toggleVisibility = !toggleVisibility"
>
Toggle visibility
</nord-tag>
</nord-banner>
<nord-range
label="Select rate"
hint="Choose `0` value to reactively hide the field below"
:value="range"
:min="0"
:max="10"
@input="range = ($event.target as HTMLInputElement).value"
></nord-range>
<!-- Vue components -->
<ReadOnlyField
v-if="range !== '0'"
:label="`Field with value ${range}`"
:value="range !== '0' ? range : undefined"
/>
<ReadOnlyField label="Field without value" />
<ReadOnlyField label="Flat field with content" value="This is a string" />
<!-- HTML tags -->
<p>This a standard paragraph</p>
<p v-if="toggleVisibility">
This a paragraph with <b>v-if</b> directive based on the toggle
</p>
<!-- eslint-disable-next-line vue/no-static-inline-styles -->
<p style="display: none">
This a paragraph with <b>display: none</b>, should not be visible
</p>
<p v-show="toggleVisibility">
This paragraph has a <b>v-show</b> based on the toggle
</p>
<p :style="!toggleVisibility ? 'visibility: hidden' : undefined">
This paragraph has <b>visibility: hidden</b> based on the toggle
</p>
<p :style="!toggleVisibility ? 'opacity: 0' : undefined">
This paragraph has <b>opacity: 0</b> based on the toggle
</p>
</DividedStack>
</div>
</template>
Integration
This community asset is currently only available to use in the New Frontend for Provet Cloud.
Troubleshooting
If you experience any issues while using this community asset, please ask for support in the #vet-frontend Slack channel.