ctrl+k
Enter a search term above to see results...
Enter a search term above to see results...
The defineComponent
function is a core part of the Semantic UI Component system. It allows you to create web components or subtemplates with advanced features such as templating, state management, and event handling.
API Reference Only - Please refer to the extensive component usage guide for how to use components in practices and component examples for practical examples.
tagName
is provided, the component is registered as a custom element and can be used in HTML like any other tag.defineComponent
to use it in other component by passing in through the subTemplates
objectdefineComponent
is used to define a new component. It can be used to define web components or components to be used elsewhere like subtemplates.
Name | Type | Description |
---|---|---|
options | Object | Configuration options for the component |
Name | Type | Description |
---|---|---|
tagName | string | The custom element name for the web component |
template | string | The HTML template string for the component |
ast | Object[] | Precompiled Abstract Syntax Tree of the template |
css | string | CSS styles for the component |
pageCSS | string | Global CSS styles to be added when the component is defined |
state | Object | Initial state configuration for the component |
events | Object | Event handlers for the component |
keys | Object | Key bindings for the component |
createComponent | Function | Function that returns the component instance |
onCreated | Function | Callback function called when the component is created |
onRendered | Function | Callback function called when the component is rendered |
onDestroyed | Function | Callback function called when the component is destroyed |
onThemeChanged | Function | Callback function called when the theme changes |
properties | Object | Custom properties for the component |
settings | Object | Settings for JavaScript functionality |
subTemplates | Object | Subtemplates used within this component |
tagName
is provided: Returns the defined web component class.tagName
is omitted: Returns a Template
instance for use as a subtemplate.defineComponent
can export components that can be consumed in other components as subTemplates.