-
-
Notifications
You must be signed in to change notification settings - Fork 597
[6.x] Widget headers are optional #12973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Philipp Daun <[email protected]>
|
Great idea but needing to pass an empty span feels a bit hacky. Maybe we can have a |
|
@jasonvarga True. I could change it to check for the existence of the slot, and hide it if it's defined but empty? |
|
I mean forget a slot. Just have a |
|
I see. I was going to say it's still useful to have the slot to render custom headers/actions, but hiding the header and rendering whatever actions inside the default slot would work just as well. I'll turn it into a prop :) |
|
I don't love having to set a prop to hide something if possible. I swapped this around so now if you have a title and/or icon it works the way it does now, otherwise you can push into the slot and override it. Looks cleaner to me. |
|
Do we even need the |
Yeah I guess not! |
Wrap the widget component's header in a named slot to allow components without headers or with custom headers.
Example
Use case: we have a map widget that doesn't need – and looks better without – a header. Rendering an empty slot requires passing in an empty
spanordiv. Just an emptytemplatetag won't do, that's a limitation of Vue I think.Note
Widget.vuenow shows the header only iftitle,icon, oractionsslot exist; props updated and icon/title rendered conditionally.resources/js/components/ui/Widget.vuehasHeader(viauseSlots/computed) to render<header>only whentitle,icon, oractionsslot is present.Iconand title only if corresponding props are provided.definePropswith typedprops; removes default icon andhrefrequirement.Written by Cursor Bugbot for commit 737dadc. This will update automatically on new commits. Configure here.