Add badge to select2 element
Hello,
I'm trying to add a badge to an option inside of a select2 element, but doesn't seem to render properly.
Here is my sample code:
<select class="form-select form-select-solid mt-5"
data-control="select2" data-placeholder="Select a price
level"
data-hide-search="true">
<option></option>
<option value="1">Retail Price</option>
<option value="2">Price 2</option>
<option value="3">
Price 3 <span class="badge badge-light-success">Default</span>
</option>
<option value="4">Price 4</option>
</select> Any idea how I can get this to work?
Replies (1)
Hi,
You can check Select2 Custom Render docs to customize the select2 items as per your requirements.
if you need any further help please let us know.
Regards.