|
| 1 | +--- |
| 2 | +title: Filter Pills Methods |
| 3 | +weight: 8 |
| 4 | +--- |
| 5 | + |
| 6 | +You can customise the appearance/behaviour of the Filter Pills. |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## setFilterPillsStatus |
| 11 | + |
| 12 | +**Enabled by default**, show/hide the filter pills. |
| 13 | + |
| 14 | +```php |
| 15 | +public function configure(): void |
| 16 | +{ |
| 17 | + $this->setFilterPillsStatus(true); |
| 18 | + $this->setFilterPillsStatus(false); |
| 19 | +} |
| 20 | +``` |
| 21 | + |
| 22 | +## setFilterPillsEnabled |
| 23 | + |
| 24 | +Show the filter pills for the component. |
| 25 | + |
| 26 | +```php |
| 27 | +public function configure(): void |
| 28 | +{ |
| 29 | + // Shorthand for $this->setFilterPillsStatus(true) |
| 30 | + $this->setFilterPillsEnabled(); |
| 31 | +} |
| 32 | +``` |
| 33 | + |
| 34 | +## setFilterPillsDisabled |
| 35 | + |
| 36 | +Hide the filter pills for the component. |
| 37 | + |
| 38 | +```php |
| 39 | +public function configure(): void |
| 40 | +{ |
| 41 | + // Shorthand for $this->setFilterPillsStatus(false) |
| 42 | + $this->setFilterPillsDisabled(); |
| 43 | +} |
| 44 | +``` |
| 45 | + |
| 46 | +--- |
| 47 | + |
| 48 | + |
| 49 | +## Customising Appearance |
| 50 | + |
| 51 | +You can customise the appearance of the items in the Filter Pills |
| 52 | + |
| 53 | +### setFilterPillsItemAttributes |
| 54 | +Allows for customisation of the appearance of the "Filter Pills Item" |
| 55 | + |
| 56 | +Note that each filter has a setFilterPillBlade method [Here](./available-filter-methods) should you wish to customise a specific filter's pills further |
| 57 | + |
| 58 | +This utilises a refreshed approach for attributes, and allows for appending to, or replacing the styles and colors independently, via the below methods. |
| 59 | + |
| 60 | +#### default-colors |
| 61 | +Setting to false will disable the default colors for the Filter Pills Item, the default colors are: |
| 62 | + |
| 63 | +Bootstrap: None |
| 64 | + |
| 65 | +Tailwind: `bg-indigo-100 text-indigo-800 dark:bg-indigo-200 dark:text-indigo-900` |
| 66 | + |
| 67 | +#### default-styling |
| 68 | +Setting to false will disable the default styling for the Filter Pills Item, the default styling is: |
| 69 | + |
| 70 | +Bootstrap 4: `badge badge-pill badge-info d-inline-flex align-items-center` |
| 71 | + |
| 72 | +Bootstrap 5: `badge rounded-pill bg-info d-inline-flex align-items-center` |
| 73 | + |
| 74 | +Tailwind: `inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium leading-4 capitalize` |
| 75 | + |
| 76 | +```php |
| 77 | +public function configure(): void |
| 78 | +{ |
| 79 | + $this->setFilterPillsItemAttributes([ |
| 80 | + 'class' => 'bg-rose-300 text-rose-800 dark:bg-indigo-200 dark:text-indigo-900', // Add these classes to the filter pills item |
| 81 | + 'default-colors' => false, // Do not output the default colors |
| 82 | + 'default-styling' => true // Output the default styling |
| 83 | + ]); |
| 84 | +} |
| 85 | +``` |
| 86 | + |
| 87 | +### setFilterPillsResetFilterButtonAttributes |
| 88 | +Allows for customisation of the appearance of the "Filter Pills Reset Filter Button" |
| 89 | + |
| 90 | +Note that this utilises a refreshed approach for attributes, and allows for appending to, or replacing the styles and colors independently, via the below methods. |
| 91 | + |
| 92 | +#### default-colors |
| 93 | +Setting to false will disable the default colors for the Filter Pills Reset Filter Button, the default colors are: |
| 94 | + |
| 95 | +Bootstrap: None |
| 96 | + |
| 97 | +Tailwind: `text-indigo-400 hover:bg-indigo-200 hover:text-indigo-500 focus:bg-indigo-500 focus:text-white` |
| 98 | + |
| 99 | +#### default-styling |
| 100 | +Setting to false will disable the default styling for the Filter Pills Reset Filter Button, the default styling is: |
| 101 | + |
| 102 | +Bootstrap: `text-white ml-2` |
| 103 | + |
| 104 | +Tailwind: `flex-shrink-0 ml-0.5 h-4 w-4 rounded-full inline-flex items-center justify-center focus:outline-none` |
| 105 | + |
| 106 | +```php |
| 107 | +public function configure(): void |
| 108 | +{ |
| 109 | + $this->setFilterPillsResetFilterButtonAttributes([ |
| 110 | + 'class' => 'text-rose-400 hover:bg-rose-200 hover:text-rose-500 focus:bg-rose-500', // Add these classes to the filter pills reset filter button |
| 111 | + 'default-colors' => false, // Do not output the default colors |
| 112 | + 'default-styling' => true // Output the default styling |
| 113 | + ]); |
| 114 | +} |
| 115 | +``` |
| 116 | + |
| 117 | +### setFilterPillsResetAllButtonAttributes |
| 118 | +Allows for customisation of the appearance of the "Filter Pills Reset All Button" |
| 119 | + |
| 120 | +Note that this utilises a refreshed approach for attributes, and allows for appending to, or replacing the styles and colors independently, via the below methods. |
| 121 | + |
| 122 | +#### default-colors |
| 123 | +Setting to false will disable the default colors for the Filter Pills Reset All Button, the default colors are: |
| 124 | + |
| 125 | +Bootstrap: None |
| 126 | + |
| 127 | +Tailwind: `bg-gray-100 text-gray-800 dark:bg-gray-200 dark:text-gray-900` |
| 128 | + |
| 129 | +#### default-styling |
| 130 | +Setting to false will disable the default styling for the Filter Pills Reset All Button, the default styling is: |
| 131 | + |
| 132 | +Bootstrap 4: `badge badge-pill badge-light` |
| 133 | + |
| 134 | +Bootstrap 5: `badge rounded-pill bg-light text-dark text-decoration-none` |
| 135 | + |
| 136 | +Tailwind: `inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium` |
| 137 | + |
| 138 | +```php |
| 139 | +public function configure(): void |
| 140 | +{ |
| 141 | + $this->setFilterPillsResetAllButtonAttributes([ |
| 142 | + 'class' => 'bg-rose-100 text-rose-800 dark:bg-gray-200 dark:text-gray-900', // Add these classes to the filter pills reset all button |
| 143 | + 'default-colors' => false, // Do not output the default colors |
| 144 | + 'default-styling' => true // Output the default styling |
| 145 | + ]); |
| 146 | +} |
| 147 | +``` |
0 commit comments