flexui-vue
Vue 3 composables for FlexUI's interactive components. Each composable binds a
flexui-runtime controller on
mount and disposes it on unmount, so dialog and menu state lives exactly as long
as the component that owns it.
npm install flexui-runtime flexui-vue
vue (3.5 or newer) is a peer dependency.
Dialog
<script setup>
import { useDialog } from "flexui-vue";
const { ref, open, close, isOpen } = useDialog({ closeOnBackdrop: true });
</script>
<template>
<button class="fui-btn" @click="open">Settings</button>
<dialog ref="ref" class="fui-dialog" data-fui-dialog>
<h2>Settings</h2>
<button class="fui-btn" @click="close">Done</button>
</dialog>
</template>
useDialog(options) returns ref, open(), close(), toggle() and isOpen.
Dropdown
<script setup>
import { ref as vueRef } from "vue";
import { useDropdown } from "flexui-vue";
const menu = vueRef(null);
const trigger = useDropdown(menu);
</script>
<template>
<button :ref="trigger.ref" class="fui-btn">Account</button>
<div ref="menu" role="menu">…</div>
</template>
useDropdown(menu, options) takes the menu element (a template ref) or a
selector and returns the trigger ref with the open state.
Popover
const trigger = usePopover(panel);
Tabs
<script setup>
import { useTabs } from "flexui-vue";
const { ref, activeIndex, select } = useTabs();
</script>
<template>
<div ref="ref" class="fui-tabs" data-fui-tabs>
<div role="tablist">…</div>
</div>
</template>
Theme
<script setup>
import { useTheme } from "flexui-vue";
const { mode, resolved, setMode } = useTheme();
</script>
setMode("light" | "dark" | "system") switches the theme without a rebuild, and
resolved tells you which theme is actually active.
Documentation
See the FlexUI repository and
docs/runtime.md
for markup contracts, options and events.
License
MIT