skeleton icon indicating copy to clipboard operation
skeleton copied to clipboard

Autocomplete emptyState HTML markup not working

Open alexschnabl opened this issue 3 years ago • 2 comments

Current Behavior

When using the autocoplete component emptyState prop, i expect it to render the html in the empty state:

<Autocomplete ... emptyState="<b>TEST</b>" >

However it outputs it as a string: "<b>TEST</b>" and not the bold text as it is should, am I doing something wrong?

Expected Behavior

The emptyState to render the html

alexschnabl avatar Oct 17 '23 15:10 alexschnabl

@SK4P3 the emptyState value doesn't accept HTML, only text: https://github.com/skeletonlabs/skeleton/blob/master/packages/skeleton/src/lib/components/Autocomplete/Autocomplete.svelte#L172

However, we do provide a regionEmpty class prop which will format the text using utility classes. For example:

<Autocomplete ... emptyState="Foo" regionEmpty="font-bold"  />

If you require HTML for this element please let me know and I can happily modify this to a feature request. If this satisfies your requirements feel free to close. And of course, PRs are always welcome! Thanks!

endigo9740 avatar Oct 17 '23 15:10 endigo9740

Hi thanks for the answer I was just a bit confused by the way it is worded in the doc! For me its not important right now, I initially wanted to put a button in there, that if its empty a user can click the create new button, but I just put it next to the input filed now.

But I think it wold be a good addition in the future!

alexschnabl avatar Oct 17 '23 17:10 alexschnabl