@zeix/ui-element
Version:
UIElement - a HTML-first library for reactive Web Components
56 lines (28 loc) • 999 B
Markdown
[**@zeix/ui-element**](../README.md)
***
[@zeix/ui-element](../globals.md) / component
# Function: component()
> **component**\<`P`\>(`name`, `init`, `setup`): `void`
Defined in: [src/component.ts:157](https://github.com/zeixcom/ui-element/blob/1e5ebee179adfc4619d3d0e9d2b864d1e97ba797/src/component.ts#L157)
Define a component with dependency resolution and setup function (connectedCallback)
## Type Parameters
### P
`P` *extends* [`ComponentProps`](../type-aliases/ComponentProps.md) & [`ValidateComponentProps`](../type-aliases/ValidateComponentProps.md)\<`P`\>
## Parameters
### name
`string`
Name of the custom element
### init
\{ \[K in string \| number \| symbol\]: Initializer\<P\[K\], Component\<P\>\> \} = `...`
Signals of the component
### setup
[`Setup`](../type-aliases/Setup.md)\<`P`\>
Setup function to be called after dependencies are resolved
## Returns
`void`
## Since
0.14.0
## Throws
If component name is invalid
## Throws
If property name is invalid