Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Latest commit

 

History

History

components

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Components

Components in this dir will be auto-registered, named & titled based on its file name.

Creating a component

Place a .ts or .js file with the following template, it will be installed automatically.

import { AlpineComponent } from 'alpine-typescript-extras'

export default class extends AlpineComponent {
	// your component's logic here
}

Usage in HTML

For example, if the component's file name is name.(ts|js):

<div x-data="Alpine.component('name')()">
...
</div>

Using $component magic helper

x-title attribute is automatically to components with the name of the class, so you can access it with the magic helper like this: $component('name').

Acknowledgment

Alpine Typescript. @ryangjchandler's Alpine code organization experiment.