0Pricing
Sveltejs Academy · Lesson

Declaring Props with export let

Expose component properties to parent components using the export keyword.

Props Are Exports

To declare a prop, write export let name in the component script. The keyword export exposes it to parents.

<script>
  export let name;
</script>

<p>Hello {name}!</p>

Multiple Props

List as many props as your component needs.

<script>
  export let title;
  export let count;
  export let onClick;
</script>

All lessons in this course

  1. Declaring Props with export let
  2. Passing Props from Parent
  3. Default Prop Values
  4. Forwarding Props with $$props and $$restProps
← Back to Sveltejs Academy