Skip to content

Commit

Permalink
Make tags dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
techenby committed May 14, 2024
1 parent 5ffa4b5 commit aebdf36
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions resources/views/components/form/tags.blade.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
@props(['value' => [], 'options' => []])

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/choices.js/public/assets/styles/choices.min.css" />
<script src="https://cdn.jsdelivr.net/npm/choices.js/public/assets/scripts/choices.min.js"></script>

<div
x-data="{
multiple: true,
value: [1, 2],
options: [
{ value: 1, label: 'Caleb Porzio' },
{ value: 2, label: 'Jason Beggs' },
{ value: 3, label: 'Tweedle Dee' },
{ value: 4, label: 'Tweedle Dum' },
],
value: @js($value),
options: @js($options),
init() {
this.$nextTick(() => {
let choices = new Choices(this.$refs.select)
Expand All @@ -37,7 +34,6 @@
})
}
}"
class="max-w-sm w-full"
>
<select x-ref="select" :multiple="multiple"></select>
<select x-ref="select" :multiple="multiple" {{ $attributes->only(['id', 'name']) }}></select>
</div>

0 comments on commit aebdf36

Please sign in to comment.