---
title: Public API of a component
---
### Public API of a component
Svelte uses the `$props` rune to declare _properties_ or _props_, which means describing the public interface of the component which becomes accessible to consumers of the component.
> [!NOTE] `$props` is one of several runes, which are special hints for Svelte's compiler to make things reactive.
```svelte
```
You can specify a fallback value for a prop. It will be used if the component's consumer doesn't specify the prop on the component when instantiating the component, or if the passed value is `undefined` at some point.
```svelte
```
To get all properties, use rest syntax:
```svelte
```
You can use reserved words as prop names.
```svelte
```
If you're using TypeScript, you can declare the prop types:
```svelte
```
If you're using JavaScript, you can declare the prop types using JSDoc:
```svelte
```
If you export a `const`, `class` or `function`, it is readonly from outside the component.
```svelte
```
Readonly props can be accessed as properties on the element, tied to the component using [`bind:this` syntax](bindings#bind:this).
### Reactive variables
To change component state and trigger a re-render, just assign to a locally declared variable that was declared using the `$state` rune.
Update expressions (`count += 1`) and property assignments (`obj.x = y`) have the same effect.
```svelte
```
Svelte's `
```
If you'd like to react to changes to a prop, use the `$derived` or `$effect` runes instead.
```svelte
```
For more information on reactivity, read the documentation around runes.