Skip to content

Is there a way to allow in my custom component the data-* props? #8476

@frederikhors

Description

@frederikhors

Describe the problem

I'm not a fan of {...$$restProps} because:

  1. if I'm creating a component I would like to handle the possible props

  2. when using my custom component and I have a prop like isDisabled and by mistake I use disabled nor my IDE nor npm run check can alert me about this error

So I would like to remove {...$$restProps} from my custom component even because the only need I have now is because I need to pass this:

<script lang="ts">
	import Button from '$lib/Button.svelte';

	export let stat = false;
</script>

<Button
	on:click={() => something}
	data-stat={stat ? 'something' : undefined}
>
  Hello
</Button>

Is there a way to allow in Button (my custom component) the data-* props?

Importance

would make my life easier

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions