Methods #

It is common to be able to call a method and perform an action. To achieve this, you can define methods when creating your component.
Methods are functions that can be defined anywhere in the component definition object.

createCustomElement('example-component', {
props: {
name: {
type: String
family: {
type: String
title: {
type: String
formatName (name, family, title) {
return `${title} ${name} ${family}`
render () {
return html`



Methods are available anywhere in your component - inside getters or rendering. They are bound to the component instance.