F
Filament•3mo ago
TranceCode

Category checkbox tree in filament?

Is there a component that allows me to do something like this in Filament? I really need something like this to place and assign categories to products in an e-commerce store.
No description
No description
4 Replies
Lirux
Lirux•3mo ago
Filament
Select Tree by CodeWithDennis - Filament
The multi-level select field lets you pick one or multiple options from a list that's neatly organized into different levels.
TranceCode
TranceCodeOP•3mo ago
Thank you bro! i will try this!
TranceCode
TranceCodeOP•3mo ago
I fix my problem using this code!
Section::make()
->schema([
// Relationship with Parent Category
Select::make('parent_id')
->label('Parent Category')
->options(Category::whereNull('parent_id')->pluck('name', 'id'))
->searchable()
->nullable(),

// Checkbox List
CheckboxList::make('parent_categories')
->label('Parent Categories')
->options(Category::getSelectOptions())
->bulkToggleable()
->disabled()
->columns(1)
->gridDirection('row')
->columnSpanFull()
->extraAttributes([
'style' => '
max-height: 200px;
overflow-y: auto;
border: 1px solid rgb(229, 231, 235);
border-radius: 0.5rem;
padding: 1rem;
background-color: rgb(249, 250, 251);
'
])
->helperText('đź’ˇ Selecciona las categorĂ­as padre para esta categorĂ­a'),
]),
Section::make()
->schema([
// Relationship with Parent Category
Select::make('parent_id')
->label('Parent Category')
->options(Category::whereNull('parent_id')->pluck('name', 'id'))
->searchable()
->nullable(),

// Checkbox List
CheckboxList::make('parent_categories')
->label('Parent Categories')
->options(Category::getSelectOptions())
->bulkToggleable()
->disabled()
->columns(1)
->gridDirection('row')
->columnSpanFull()
->extraAttributes([
'style' => '
max-height: 200px;
overflow-y: auto;
border: 1px solid rgb(229, 231, 235);
border-radius: 0.5rem;
padding: 1rem;
background-color: rgb(249, 250, 251);
'
])
->helperText('đź’ˇ Selecciona las categorĂ­as padre para esta categorĂ­a'),
]),
No description
No description
TranceCode
TranceCodeOP•3mo ago
This way I eliminate the dependency on other packages, which is something I really avoid using. Thank you very much. @Lirux

Did you find this page helpful?