@@ -24,62 +24,35 @@ composer require codewithdennis/filament-select-tree
2424## Usage
2525
2626``` PHP
27- // Required to build a tree
2827SelectTree::make('category_id')
2928 // Creates a select tree with 'Category' model, using 'category_id' as parent and 'name' as label, allowing custom query modification.
3029 ->tree(Category::class, 'category_id', 'name', function ($query) {
3130 return $query;
3231 })
33- ```
34-
35- ``` PHP
36- // The label 'Category' is assigned to the field.
37- ->label(__('Category'))
38- ```
39-
40- ``` PHP
41- // Set a custom placeholder for when no items are selected
42- ->placeholder(__('Your custom placeholder here'))
43- ```
4432
45- ``` PHP
46- // Ensures that only leaf nodes can be selected while preventing the selection of groups.
47- ->disabledBranchNode()
48- ```
33+ // Set a custom placeholder for when no items are selected
34+ ->placeholder(__('Your custom placeholder here'))
4935
50- ``` PHP
51- // Show the count of children alongside the group's name.
52- ->withCount()
53- ```
36+ // Ensures that only leaf nodes can be selected while preventing the selection of groups.
37+ ->disabledBranchNode()
5438
55- ``` PHP
56- // To keep the dropdown open at all times
57- ->alwaysOpen()
58- ```
39+ // Show the count of children alongside the group's name.
40+ ->withCount()
5941
60- ``` PHP
61- // By default, all nodes are independent.
62- ->independent(false)
63- ```
42+ // To keep the dropdown open at all times
43+ ->alwaysOpen()
6444
65- ``` php
66- // By default, the clearable icon is enabled, but you can hide it with:
67- ->clearable(false)
68- ```
45+ // By default, all nodes are independent.
46+ ->independent(false)
6947
70- ``` php
71- // Enable the option to save multiple values as a string (comma-separated)
72- ->multiple()
73- ```
48+ // By default, the clearable icon is enabled, but you can hide it with:
49+ ->clearable(false)
7450
75- ``` PHP
76- // Activates the search functionality for the SelectTree.
77- ->searchable()
78- ```
51+ // Enable the option to save multiple values as a string (comma-separated)
52+ ->multiple()
7953
80- ``` PHP
81- // The tree is disabled. (You can also use: ->disabledOn(''))
82- ->disabled(),
54+ // Activates the search functionality for the SelectTree.
55+ ->searchable()
8356```
8457
8558## Changelog
0 commit comments