Alpine.js Snippets for Zed

August 30, 2025 ยท View on GitHub

Comprehensive Alpine.js v3+ code snippets for faster development in Zed editor.

Features

  • ๐Ÿš€ 30+ Alpine.js snippets covering all major directives
  • ๐Ÿ’ก IntelliSense-friendly with descriptive names and tab stops
  • ๐ŸŽฏ Component patterns for common use cases (modals, forms, toggles)
  • ๐Ÿ“ Complete examples with proper Alpine.js syntax
  • โšก Optimized for productivity with logical tab order

Available Snippets

Core Directives

PrefixDescription
x-dataComponent data initialization
x-data-objData object with init method
x-initElement initialization hook
x-showConditional element visibility
x-bindAttribute binding
x-onEvent handling
x-textText content binding
x-htmlHTML content binding
x-modelTwo-way data binding

Conditional Rendering

PrefixDescription
x-ifConditional template rendering
x-forList rendering
x-for-keyList rendering with key

Event Shortcuts

PrefixDescription
@clickClick event handler
@submitForm submit handler
@keydownKeydown event handler

Styling & Classes

PrefixDescription
:classConditional CSS classes
:styleInline style binding

Transitions

PrefixDescription
x-transitionBasic transition
x-transition-enterEnter transition classes
x-transition-leaveLeave transition classes

Component Patterns

PrefixDescription
alpine-compBasic component structure
alpine-modalModal component
alpine-toggleToggle component
alpine-formForm with validation

Utilities

PrefixDescription
x-cloakHide until initialized
x-ignoreSkip Alpine initialization
x-refElement reference
x-teleportMove element in DOM
alpine-cdnAlpine.js CDN script
alpine-storeGlobal store definition

Installation

  1. Clone or download this extension
  2. Place in your Zed extensions directory
  3. Restart Zed
  4. Start typing Alpine.js snippets in HTML files!

Usage

Simply start typing any snippet prefix in an HTML file and press Tab to expand. Use Tab to navigate through placeholder values.

Example

Type alpine-comp and press Tab:

<div x-data="{
  property: value,
  
  init() {
    // initialization code
  },
  
  method() {
    // method body
  }
}">
  <!-- component content -->
</div>

Contributing

Found a bug or want to add more snippets? Contributions are welcome!

Resources

License

MIT License - see LICENSE file for details.