Skip to content

How can I change the background of a custom modal? #1551

Answered by endigo9740
avecalme asked this question in Q&A
Discussion options

You must be logged in to vote

@avecalme think of component modals as custom modals. There's a couple ways to go about this:

Method 1 - using the props object

When you're passing props: { background: 'bg-red-500' }, what we're doing is taking the component definition you've provided (reference, props, slot) and dynamically constructing that component for your within the Modal component on-demand using <svelte:component>.

In order to access the props value within your custom component, you have to setup your component to accept that prop as you would for any custom component:

export let background: string = 'someDefaultValue'

Then you can use background as a proper within your custom generated component.

To be honest, t…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@avecalme
Comment options

Comment options

You must be logged in to vote
1 reply
@avecalme
Comment options

Answer selected by avecalme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants