Constructor
# <BaseActionComponent />
Component which renders all the default and custom actions for both the Resource and the Record.
It passes all props down to the actual Action component.
Example of creating your own actions:
// AdminJS options
const AdminJSOptions = {
resources: [
resource,
options: {
actions: {
myNewAction: {
label: 'amazing action',
icon: 'Add',
inVisible: (resource, record) => record.param('email') !== '',
actionType: 'record',
component: AdminJS.bundle('./my-new-action'),
handler: (request, response, data) => {
return {
...
}
}
}
}
}
]
}
// ./my-new-action.jsx
import { Box } from 'adminjs'
const MyNewAction = (props) => {
const { resource, action, record } = props
// do something with the props and render action
return (
<Box>Some Action Content</Box>
)
}
Type Definitions
object
# ActionProps
Props which are passed to all action components
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
action |
ActionJSON
|
Action object describing the action |
|
resource |
ResourceJSON
|
Object of type: ResourceJSON |
|
record |
RecordJSON
|
<optional> |
Selected record. Passed for actions with "record" actionType |
records |
Array.<RecordJSON>
|
<optional> |
Selected records. Passed for actions with "bulk" actionType |
setTag |
Dispatch.<SetStateAction.<string>>
|
<optional> |
Sets tag in a header of an action. It is a function taking tag as an argument |