[Custom Components] Support Named Slots in svelte
Author: Col0ringCreated Jul 5, 2024Updated Sep 11, 2026
Labelsenhancementcustom-componentstodo
- I have searched to see if a similar issue already exists.
Is your feature request related to a problem? Please describe.
Custom components can only use Default Slot in svelte currently, therefore it cannot provide more customized layout configurations for users. I'm wondering if gradio can provide a component like gr.Slot to support Named Slot.
Describe the solution you'd like
This is a sample to use gr.Slot:
app.py
with CustomComponent():
# default slot
gr.Button()
# named slot
with gr.Slot(name="extra"):
gr.Button()custom_components/Index.svelte
<div><slot/></div>
<div><slot name="extra"/></div>Additional context
Add any other context or screenshots about the feature request here.
Source: gradio-app/gradio