2022-09-09 20:41:18 +00:00
|
|
|
<template>
|
|
|
|
<AppDoc name="FieldsetDemo" :sources="sources" github="fieldset/FieldsetDemo.vue">
|
|
|
|
<h5>Import via Module</h5>
|
|
|
|
<pre v-code.script><code>
|
|
|
|
import Fieldset from 'primevue/fieldset';
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
|
|
|
<h5>Import via CDN</h5>
|
|
|
|
<pre v-code><code>
|
|
|
|
<script src="https://unpkg.com/primevue@^3/core/core.min.js"></script>
|
|
|
|
<script src="https://unpkg.com/primevue@^3/fieldset/fieldset.min.js"></script>
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
|
|
|
<h5>Getting Started</h5>
|
|
|
|
<p>Fieldset is a container component that accepts content as its children.</p>
|
|
|
|
<pre v-code><code>
|
|
|
|
<Fieldset legend="Godfather I">
|
|
|
|
The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.
|
|
|
|
His beloved son Michael has just come home from the war, but does not intend to become part of his father's business.
|
|
|
|
Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family,
|
|
|
|
kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
|
|
|
|
</Fieldset>
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
|
|
|
<h5>Custom Header</h5>
|
|
|
|
<p>Header of the panel is either defined with the <i>legend</i> property or the legend template.</p>
|
|
|
|
<pre v-code><code>
|
|
|
|
<Fieldset>
|
|
|
|
<template #legend>
|
|
|
|
Header Content
|
|
|
|
</template>
|
|
|
|
Content
|
|
|
|
</Fieldset>
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
|
|
|
<h5>Toggleable</h5>
|
|
|
|
<p>Content of the fieldset can be expanded and collapsed using <i>toggleable</i> option..</p>
|
|
|
|
<pre v-code><code>
|
|
|
|
<Fieldset legend="Godfather I" :toggleable="true">
|
|
|
|
The story begins as Don Vito Corleone, the head of a New York Mafia family, oversees his daughter's wedding.
|
|
|
|
His beloved son Michael has just come home from the war, but does not intend to become part of his father's business.
|
|
|
|
Through Michael's life the nature of the family business becomes clear. The business of the family is just like the head of the family,
|
|
|
|
kind and benevolent to those who give respect, but given to ruthless violence whenever anything stands against the good of the family.
|
|
|
|
</Fieldset>
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
|
|
|
<p>To control the initial state of the toggleable panel, use the <i>collapsed</i> property.</p>
|
|
|
|
<pre v-code><code>
|
|
|
|
<Fieldset legend="Header Text" :toggleable="true" :collapsed="true">
|
|
|
|
Content
|
|
|
|
</Fieldset>
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
|
|
|
<p>Use the v-model directive to enable two-way binding.</p>
|
|
|
|
<pre v-code><code>
|
|
|
|
<button type="button" @click="isCollapsed = !isCollapsed">Toggle Programmatically</button>
|
|
|
|
<Fieldset legend="Header Text" :toggleable="true" v-model:collapsed="isCollapsed">
|
|
|
|
Content
|
|
|
|
</Fieldset>
|
|
|
|
|
|
|
|
</code></pre>
|
|
|
|
|
|
|
|
<h5>Properties</h5>
|
|
|
|
<p>Any property as style and class are passed to the main container element. Following are the additional properties to configure the component.</p>
|
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Type</th>
|
|
|
|
<th>Default</th>
|
|
|
|
<th>Description</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>legend</td>
|
|
|
|
<td>string</td>
|
|
|
|
<td>null</td>
|
|
|
|
<td>Header text of the fieldset.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>toggleable</td>
|
|
|
|
<td>boolean</td>
|
|
|
|
<td>null</td>
|
|
|
|
<td>When specified, content can toggled by clicking the legend.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>collapsed</td>
|
|
|
|
<td>boolean</td>
|
|
|
|
<td>null</td>
|
|
|
|
<td>Defines the default visibility state of the content.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>toggleButtonProps</td>
|
|
|
|
<td>string</td>
|
|
|
|
<td>null</td>
|
|
|
|
<td>Uses to pass the custom value to read for the anchor inside the component.</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Events</h5>
|
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Parameters</th>
|
|
|
|
<th>Description</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>toggle</td>
|
|
|
|
<td>
|
|
|
|
event.originalEvent: browser event <br />
|
|
|
|
event.value: collapsed state as a boolean
|
|
|
|
</td>
|
|
|
|
<td>Callback to invoke when a tab gets expanded or collapsed.</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Slots</h5>
|
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Parameters</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>legend</td>
|
|
|
|
<td>-</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Styling</h5>
|
2022-09-10 14:29:14 +00:00
|
|
|
<p>Following is the list of structural style classes, for theming classes visit <nuxt-link to="/theming">theming</nuxt-link> page.</p>
|
2022-09-09 20:41:18 +00:00
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Name</th>
|
|
|
|
<th>Element</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td>p-fieldset</td>
|
|
|
|
<td>Fieldset element.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>p-fieldset-toggleable</td>
|
|
|
|
<td>Toggleable fieldset element.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>p-fieldset-legend</td>
|
|
|
|
<td>Legend element.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>p-fieldset-content</td>
|
|
|
|
<td>Content element.</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<h5>Accessibility</h5>
|
|
|
|
<DevelopmentSection>
|
|
|
|
<h6>Screen Reader</h6>
|
|
|
|
<p>
|
|
|
|
Fieldset component uses the semantic <i>fieldset</i> element. When toggleable option is enabled, a clickable element with <i>button</i> role is included inside the <i>legend</i> element, this button has <i>aria-controls</i> to define
|
|
|
|
the id of the content section along with <i>aria-expanded</i> for the visibility state. The value to read the button defaults to the value of the <i>legend</i> property and can be customized by defining an <i>aria-label</i> or
|
|
|
|
<i>aria-labelledby</i> via the <i>toggleButtonProps</i> property.
|
|
|
|
</p>
|
|
|
|
<p>The content uses <i>region</i>, defines an id that matches the <i>aria-controls</i> of the content toggle button and <i>aria-labelledby</i> referring to the id of the header.</p>
|
|
|
|
|
|
|
|
<h6>Content Toggle Button Keyboard Support</h6>
|
|
|
|
<div class="doc-tablewrapper">
|
|
|
|
<table class="doc-table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Key</th>
|
|
|
|
<th>Function</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
<tr>
|
|
|
|
<td><i>tab</i></td>
|
|
|
|
<td>Moves focus to the next the focusable element in the page tab sequence.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><i>shift</i> + <i>tab</i></td>
|
|
|
|
<td>Moves focus to the previous the focusable element in the page tab sequence.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><i>enter</i></td>
|
|
|
|
<td>Toggles the visibility of the content.</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td><i>space</i></td>
|
|
|
|
<td>Toggles the visibility of the content.</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</DevelopmentSection>
|
|
|
|
|
|
|
|
<h5>Dependencies</h5>
|
|
|
|
<p>None.</p>
|
|
|
|
</AppDoc>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
sources: {
|
|
|
|
'options-api': {
|
|
|
|
tabName: 'Options API Source',
|
|
|
|
content: `
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<h5>Regular</h5>
|
|
|
|
<Fieldset legend="Header">
|
|
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
|
|
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
|
|
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
|
|
|
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
|
|
</Fieldset>
|
|
|
|
|
|
|
|
<h5>Toggleable</h5>
|
|
|
|
<Fieldset legend="Header" :toggleable="true">
|
|
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
|
|
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
|
|
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
|
|
|
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
|
|
</Fieldset>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
}
|
|
|
|
<\\/script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.fieldset p {
|
|
|
|
line-height: 1.5;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
</style>`
|
|
|
|
},
|
|
|
|
'composition-api': {
|
|
|
|
tabName: 'Composition API Source',
|
|
|
|
content: `
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<h5>Regular</h5>
|
|
|
|
<Fieldset legend="Header">
|
|
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
|
|
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
|
|
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
|
|
|
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
|
|
</Fieldset>
|
|
|
|
|
|
|
|
<h5>Toggleable</h5>
|
|
|
|
<Fieldset legend="Header" :toggleable="true">
|
|
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
|
|
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
|
|
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
|
|
|
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
|
|
</Fieldset>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
}
|
|
|
|
<\\/script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.fieldset p {
|
|
|
|
line-height: 1.5;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
</style>`
|
|
|
|
},
|
|
|
|
'browser-source': {
|
|
|
|
tabName: 'Browser Source',
|
|
|
|
imports: `<script src="https://unpkg.com/primevue@^3/fieldset/fieldset.min.js"><\\/script>`,
|
|
|
|
content: `<div id="app">
|
|
|
|
<h5>Regular</h5>
|
|
|
|
<fieldset legend="Header">
|
|
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
|
|
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
|
|
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
|
|
|
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
|
|
</fieldset>
|
|
|
|
|
|
|
|
<h5>Toggleable</h5>
|
|
|
|
<fieldset legend="Header" :toggleable="true">
|
|
|
|
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
|
|
|
|
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
|
|
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
|
|
|
|
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
|
|
|
|
</fieldset>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script type="module">
|
|
|
|
const { createApp } = Vue;
|
|
|
|
|
|
|
|
const App = {
|
|
|
|
components: {
|
|
|
|
"fieldset": primevue.fieldset
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
createApp(App)
|
|
|
|
.use(primevue.config.default)
|
|
|
|
.mount("#app");
|
|
|
|
<\\/script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.fieldset p {
|
|
|
|
line-height: 1.5;
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
};
|
|
|
|
</script>
|