@@ -263,4 +263,63 @@ bulkActions: [
263263 },
264264 }
265265],
266+ ```
267+
268+ ## Custom Component
269+
270+ If you want to style an action's button/icon without changing its behavior, attach a custom UI wrapper via ` customComponent ` .
271+ The file points to your SFC in the custom folder (alias ` @@/ ` ), and ` meta ` lets you pass lightweight styling options (e.g., border color, radius).
272+
273+ ``` ts title="./resources/apartments.ts"
274+ {
275+ resourceId : ' aparts' ,
276+ options : {
277+ actions : [
278+ {
279+ name: ' Auto submit' ,
280+ icon: ' flowbite:play-solid' ,
281+ // UI wrapper for the built-in action button
282+ // diff-add
283+ customComponent: {
284+ // diff-add
285+ file: ' @@/ActionBorder.vue' , // SFC path in your custom folder
286+ // diff-add
287+ meta: { color: ' #94a3b8' , radius: 10 } // free-form styling params
288+ // diff-add
289+ },
290+ showIn: { list: true , showButton: true , showThreeDotsMenu: true },
291+ action : async ({ recordId , adminUser }) => {
292+ return { ok: true , successMessage: ' Auto submitted' };
293+ }
294+ }
295+ ]
296+ }
297+ }
298+ ```
299+
300+ Use this minimal wrapper component to add a border/rounding around the default action UI while keeping the action logic intact.
301+ Keep the ` <slot /> ` (that's where AdminForth renders the default button) and emit ` callAction ` to trigger the handler when the wrapper is clicked.
302+
303+ ``` ts title="./custom/ActionBorder.vue"
304+ <template >
305+ < ! -- Keep the slot : AdminForth renders the default action button / icon here -- >
306+ < ! -- Emit ` callAction ` to trigger the action when the wrapper is clicked -- >
307+ < div :style = " styleObj" @click = " emit('callAction')" >
308+ < slot / >
309+ < / div >
310+ < / template >
311+
312+ < script setup lang = " ts" >
313+ import { computed } from ' vue' ;
314+
315+ const props = defineProps <{ meta? : { color? : string ; radius? : number ; padding? : number } }>();
316+ const emit = defineEmits <{ (e : ' callAction' , payload ? : unknown ): void }>();
317+
318+ const styleObj = computed (() => ({
319+ display: ' inline-block' ,
320+ border: ` 1px solid ${props .meta ?.color ?? ' #e5e7eb' } ` ,
321+ borderRadius: (props .meta ?.radius ?? 8 ) + ' px' ,
322+ padding: (props .meta ?.padding ?? 2 ) + ' px' ,
323+ }));
324+ < / script >
266325```
0 commit comments