FieldGroup
Usage
Wrap multiple Button within a FieldGroup to group them together.
<template>
<PFieldGroup>
<PButton color="neutral" variant="subtle" label="Button" />
<PButton color="neutral" variant="outline" icon="i-lucide:chevron-down" />
</PFieldGroup>
</template>
Size
Use the size prop to change the size of all the buttons.
<template>
<PFieldGroup size="xl">
<PButton color="neutral" variant="subtle" label="Button" />
<PButton color="neutral" variant="outline" icon="i-lucide:chevron-down" />
</PFieldGroup>
</template>
Orientation
Use the orientation prop to change the orientation of the buttons. Defaults to horizontal.
<template>
<PFieldGroup orientation="vertical">
<PButton color="neutral" variant="subtle" label="Submit" />
<PButton color="neutral" variant="outline" label="Cancel" />
</PFieldGroup>
</template>
Examples
With input
You can use components like Input, InputMenu, Select SelectMenu, etc. within a field group.
<template>
<PFieldGroup>
<PInput color="neutral" variant="outline" placeholder="Enter token" />
<PButton color="neutral" variant="subtle" icon="i-lucide:clipboard" />
</PFieldGroup>
</template>
With tooltip
You can use a Tooltip within a field group.
<template>
<PFieldGroup>
<PInput
color="neutral"
variant="outline"
placeholder="Enter token"
/>
<PTooltip text="Copy to clipboard">
<PButton
color="neutral"
variant="subtle"
icon="i-lucide:clipboard"
/>
</PTooltip>
</PFieldGroup>
</template>
With dropdown menu
You can use a DropdownMenu within a field group.
<script setup lang="ts">
import type { PPDropdownMenuItem } from 'pohon-ui';
const items: Array<PPDropdownMenuItem> = [
{
label: 'Team',
icon: 'i-lucide:users',
},
{
label: 'Invite users',
icon: 'i-lucide:user-plus',
children: [
{
label: 'Invite by email',
icon: 'i-lucide:send-horizontal',
},
{
label: 'Invite by link',
icon: 'i-lucide:link',
},
],
},
{
label: 'New team',
icon: 'i-lucide:plus',
},
];
</script>
<template>
<PFieldGroup>
<PButton
color="neutral"
variant="subtle"
label="Settings"
/>
<PDropdownMenu :items="items">
<PButton
color="neutral"
variant="outline"
icon="i-lucide:chevron-down"
/>
</PDropdownMenu>
</PFieldGroup>
</template>
With badge
You can use a Badge within a field group.
<template>
<PFieldGroup>
<PBadge
color="neutral"
variant="outline"
size="lg"
label="https://"
/>
<PInput
color="neutral"
variant="outline"
placeholder="www.example.com"
/>
</PFieldGroup>
</template>
API
Props
| Prop | Default | Type |
|---|---|---|
as | 'div' | anyThe element or component this component should render as. |
size | 'md' | "md" | "xs" | "sm" | "lg" | "xl" |
orientation | 'horizontal' | "horizontal" | "vertical"The orientation the buttons are laid out. |
pohon | {} |
Slots
| Slot | Type |
|---|---|
default | object |
Theme
Below is the theme configuration skeleton for the PFieldGroup. Since the component is provided unstyled by default, you will need to fill in these values to apply your own custom look and feel. If you prefer to use our pre-built, opinionated styling, you can instead use our UnoCSS preset, this docs is using it as well.
export default defineAppConfig({
pohon: {
fieldGroup: {
base: '',
variants: {
size: {
xs: '',
sm: '',
md: '',
lg: '',
xl: ''
},
orientation: {
horizontal: '',
vertical: ''
}
}
}
}
};
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import pohon from 'pohon-ui/vite'
export default defineAppConfig({
pohon: {
fieldGroup: {
base: '',
variants: {
size: {
xs: '',
sm: '',
md: '',
lg: '',
xl: ''
},
orientation: {
horizontal: '',
vertical: ''
}
}
}
}
};