Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreyu committed Feb 9, 2025
1 parent 25aacb2 commit 1ee6c65
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
30 changes: 29 additions & 1 deletion docs/src/reference/types/action/dropdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ The [`DropdownActionType`](https://github.com/Kreyu/data-table-bundle/blob/main/
### `actions`

- **type**: `array` or `callable` (if using as a row action)
- **default**: `[]`

An array of actions that will be rendered as dropdown items.
Each action can be created using `createAction`, `createRowAction` or `createBatchAction` method, depending on the context:
Expand All @@ -31,6 +30,9 @@ $builder
;
```

While theoretically you _can_ use wrong method for dropdown items, e.g. `createBatchAction` for a dropdown action created by `addRowAction`,
the bundle will automatically change the context of the action to the proper one. However, try to use proper methods for better readability.

When using the `DropdownActionType` as a [row action](../../../docs/components/actions.md), you can provide a callable
that will receive the row data as an argument and should return an array of actions.

Expand All @@ -56,6 +58,32 @@ $builder
> Therefore, it is recommended to use [`LinkDropdownItemActionType`](link-dropdown-item.md) for dropdown items,
> so it will be rendered properly as a simple link.
### `with_caret`

- **type**: `bool`
- **default**: `true`

Whether to render a caret icon next to the dropdown label. For example:

![Dropdown action with and without caret example](../../../public/dropdown_action_type_with_caret_example.png)

```php
use Kreyu\Bundle\DataTableBundle\Action\Type\Dropdown\DropdownActionType;

$builder
->addRowAction('dropdownWithCaret', DropdownActionType::class, [
'label' => 'Dropdown with caret',
'with_caret' => true,
'actions' => [...],
])
->addRowAction('dropdownWithoutCaret', DropdownActionType::class, [
'label' => '···',
'with_caret' => false,
'actions' => [...],
])
;
```

## Inherited options

<ActionTypeOptions/>
4 changes: 2 additions & 2 deletions docs/src/reference/types/action/options/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ $builder
Defines the HTML attributes for the icon to render.

```php
use Kreyu\Bundle\DataTableBundle\Column\Type\IconColumnType;
use Kreyu\Bundle\DataTableBundle\Action\Type\ButtonActionType;

$builder
->addColumn('status', IconColumnType::class, [
->addRowAction('status', ButtonActionType::class, [
'icon' => 'check',
'icon_attr' => [
'class' => 'text-success',
Expand Down

0 comments on commit 1ee6c65

Please sign in to comment.