# Snippet

The Snippet class includes shared code parts in templates and allows to pass data as well as to optionally pass content to various predefined slots.

****

- Full class name: `Kirby\Template\Snippet`
- Alias: `Snippet`
- Source: <https://github.com/getkirby/kirby/tree/5.5.3/src/Template/Snippet.php#L24>

****

### Snippet

- [new Snippet()](https://getkirby.com/docs/reference/objects/template/snippet/__construct.md)
- [Snippet::begin()](https://getkirby.com/docs/reference/objects/template/snippet/begin.md)
- [$snippet->close()](https://getkirby.com/docs/reference/objects/template/snippet/close.md)
- [Snippet::end()](https://getkirby.com/docs/reference/objects/template/snippet/end.md)
- [$snippet->endslot()](https://getkirby.com/docs/reference/objects/template/snippet/endslot.md)
- [Snippet::factory()](https://getkirby.com/docs/reference/objects/template/snippet/factory.md)
- [Snippet::file()](https://getkirby.com/docs/reference/objects/template/snippet/file.md)
- [$snippet->hasSlots()](https://getkirby.com/docs/reference/objects/template/snippet/has-slots.md)
- [Snippet::load()](https://getkirby.com/docs/reference/objects/template/snippet/load.md)
- [$snippet->open()](https://getkirby.com/docs/reference/objects/template/snippet/open.md)
- [$snippet->parent()](https://getkirby.com/docs/reference/objects/template/snippet/parent.md)
- [$snippet->render()](https://getkirby.com/docs/reference/objects/template/snippet/render.md)
- [Snippet::root()](https://getkirby.com/docs/reference/objects/template/snippet/root.md)
- [$snippet->slot()](https://getkirby.com/docs/reference/objects/template/snippet/slot.md)
- [$snippet->slots()](https://getkirby.com/docs/reference/objects/template/snippet/slots.md)