UI Kit - A collection of reusable Vue 3 components
You can install directly from GitHub (this will run the package's prepare script to build before install):
# npm
npm install sw-consulting/tooling.ui.kit
# or with a specific branch or tag
npm install sw-consulting/tooling.ui.kit#main
# yarn
yarn add sw-consulting/tooling.ui.kitThis library requires the following peer dependencies:
vue^3.0.0vuetify^3.11.3@fortawesome/vue-fontawesome^3.1.2@fortawesome/fontawesome-svg-core^7.1.0
A customizable action button component with Vuetify tooltip and FontAwesome icon support.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
item |
any | Yes | - | The item data to emit on click |
icon |
String | Yes | - | FontAwesome icon class (e.g., 'fa-solid fa-pen') |
tooltipText |
String | Yes | - | Text to display in the tooltip |
iconSize |
String | No | '1x' | FontAwesome icon size |
disabled |
Boolean | No | false | Whether the button is disabled |
variant |
String | No | 'default' | Color variant: 'default', 'orange', 'green', 'red', or 'blue' |
click: Emitted when the button is clicked, passes theitemprop as payload
<script setup>
import { ActionButton } from 'tooling.ui.kit'
const handleEdit = (item) => {
console.log('Editing item:', item)
}
</script>
<template>
<ActionButton
:item="{ id: 1, name: 'Sample Item' }"
icon="fa-solid fa-pen"
tooltip-text="Edit item"
variant="blue"
@click="handleEdit"
/>
</template>The ActionButton supports different color variants:
default- Gray with blue hover (#1976d2)orange- Orange (#ff6b35) with lighter hover (#ff8c42)green- Green (#4caf50) with lighter hover (#66bb6a)red- Red (#d3223f) with lighter hover (#e34b5f)blue- Blue (#1976d2) with lighter hover (#2196f3)
A two-level action button component that wraps ActionButton to provide dropdown menu functionality with full keyboard navigation support. Perfect for context menus, row actions, and any scenario requiring multiple action options.
ActionButton2L inherits all props from ActionButton and adds:
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
item |
any | Yes | - | The item data to emit on click and pass to option actions |
icon |
String | Yes | - | FontAwesome icon class (e.g., 'fa-solid fa-ellipsis-vertical') |
tooltipText |
String | Yes | - | Text to display in the tooltip |
iconSize |
String | No | '1x' | FontAwesome icon size |
disabled |
Boolean | No | false | Whether the button is disabled |
variant |
String | No | 'default' | Color variant: 'default', 'orange', 'green', 'red', or 'blue' |
options |
Array | No | [] | Array of menu options with shape { label: string, action: function, disabled?: boolean } |
open: Emitted when the dropdown menu opensclose: Emitted when the dropdown menu closesselect: Emitted when a menu option is selected, passes{ option, index }as payload
Each option in the options array should have the following structure:
interface MenuOption {
label: string // Display text for the menu item
action: (item: any) => void | Promise<void> // Function to execute when selected
disabled?: boolean // Optional: whether the option is disabled
}<script setup>
import { ActionButton2L } from 'tooling.ui.kit'
const user = { id: 1, name: 'John Doe', status: 'active' }
const handleEdit = (user) => {
console.log('Editing user:', user)
}
const handleDelete = async (user) => {
console.log('Deleting user:', user)
// Async operations are supported
}
const handleToggleStatus = (user) => {
console.log('Toggling status for:', user)
}
const menuOptions = [
{ label: 'Edit', action: handleEdit },
{ label: 'Delete', action: handleDelete },
{ label: 'Deactivate', action: handleToggleStatus, disabled: user.status !== 'active' }
]
const handleMenuOpen = () => {
console.log('Menu opened')
}
const handleMenuSelect = ({ option, index }) => {
console.log('Selected:', option.label, 'at index', index)
}
</script>
<template>
<ActionButton2L
:item="user"
icon="fa-solid fa-ellipsis-vertical"
tooltip-text="User actions"
:options="menuOptions"
variant="default"
@open="handleMenuOpen"
@select="handleMenuSelect"
/>
</template>ActionButton2L provides full keyboard accessibility:
- Arrow Down / Arrow Up: Open menu when closed, navigate between options when open
- Enter: Activate the focused menu option
- Escape: Close the menu and return focus to the button
- Tab: Standard focus management with disabled items automatically skipped
The component automatically:
- Focuses the first enabled option when the menu opens
- Wraps navigation at the top and bottom of the menu
- Skips disabled options during keyboard navigation
- Manages ARIA attributes for screen reader compatibility
- Full ARIA support with
role="menu"androle="menuitem" - Proper
aria-haspopup,aria-expanded, andaria-controlsattributes - Dynamic
aria-disabledstates for disabled options - Focus management with appropriate
tabindexvalues - Unique IDs for each menu instance
Table Row Actions
<template>
<ActionButton2L
:item="row"
icon="fa-solid fa-ellipsis-vertical"
tooltip-text="Row actions"
:options="[
{ label: 'Edit', action: onEdit },
{ label: 'Duplicate', action: onDuplicate },
{ label: 'Delete', action: onDelete }
]"
/>
</template>Conditional Options
<script setup>
const getOptions = (item) => [
{ label: 'View', action: onView },
{ label: 'Activate', action: onActivate, disabled: item.status === 'active' },
{ label: 'Deactivate', action: onDeactivate, disabled: item.status !== 'active' }
]
</script>
<template>
<ActionButton2L
:item="item"
icon="fa-solid fa-gear"
tooltip-text="Settings"
:options="getOptions(item)"
/>
</template>ISC