Oxpecker.Alpine 0.1.1

dotnet add package Oxpecker.Alpine --version 0.1.1
                    
NuGet\Install-Package Oxpecker.Alpine -Version 0.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Oxpecker.Alpine" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Oxpecker.Alpine" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="Oxpecker.Alpine" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Oxpecker.Alpine --version 0.1.1
                    
#r "nuget: Oxpecker.Alpine, 0.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Oxpecker.Alpine@0.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Oxpecker.Alpine&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=Oxpecker.Alpine&version=0.1.1
                    
Install as a Cake Tool


Oxpecker.Alpine

Oxpecker.Alpine extends Oxpecker.ViewEngine with typed Alpine.js directives.

Nuget package dotnet add package Oxpecker.Alpine

Each Alpine directive is exposed as a fluent extension method on HtmlTag, so attributes chain directly onto a tag with zero allocation overhead. The { children } builder syntax still works at the end of the chain:

open Oxpecker.ViewEngine
open Oxpecker.Alpine

let dropdown =
    div().xData("{ open: false }") {
        button(type' = "button").xOn("click", "open = !open") { "Toggle" }
        div().xShow("open").xOn("click.outside", "open = false") {
            "Dropdown contents"
        }
    }

Documentation

Please refer to the official Alpine.js site for directive behavior and supported expressions.

API

After opening the Oxpecker.Alpine namespace you'll get access to the Alpine directives:

Method Renders Notes
xData x-data Valueless and value overloads.
xInit x-init
xEffect x-effect
xShow x-show Optional modifiers overload (e.g. XShowModifier.important).
xBind x-bind:<name> name may include modifiers (e.g. "class.camel").
xOn x-on:<event> event may include modifiers (e.g. "submit.prevent.once").
xText x-text
xHtml x-html
xModel x-model Optional modifiers overload (e.g. XModelModifier.number).
xModelable x-modelable
xFor x-for
xIf x-if
xTransition x-transition Valueless; optional modifiers overload.
xTransitionOn x-transition:<phase> Phase-specific transition. Optional modifiers overload.
xRef x-ref
xId x-id
xCloak x-cloak Boolean — only renders when true.
xIgnore x-ignore Boolean — only renders when true.
xTeleport x-teleport

Directive Arguments And Modifiers

For xOn and xBind, modifiers are written directly into the directive name string, exactly as you would in markup:

// Renders x-on:submit.prevent.once="save()"
form().xOn("submit.prevent.once", "save()") { ... }

// Renders x-bind:class="open ? '' : 'hidden'"
div().xBind("class", "open ? '' : 'hidden'") { ... }

Other directives expose an optional modifiers parameter that is appended verbatim to the attribute name. Pass it with the leading . (the bundled helper modules already include it):

// Renders x-show.important="open"
div().xShow("open", XShowModifier.important) { ... }

// Renders x-model.number.debounce.500ms="age"
input().xModel("age", XModelModifier.number + XModelModifier.debounceMs 500)

// Renders x-transition.duration.500ms
div().xTransition(XTransitionModifier.durationMs 500) { ... }

// Renders x-transition:enter.duration.300ms
div().xTransitionOn("enter", XTransitionModifier.durationMs 300) { ... }

The following helper modules expose the most common Alpine modifier names as constants and helper functions. Each value already includes the leading . and can be concatenated with +:

Module Examples
XShowModifier important
XModelModifier number, boolean, lazy', change, blur, enter, fill, debounce, debounceMs n, throttle, throttleMs n
XTransitionModifier durationMs n, delayMs n, opacity, scale n, scaleOrigin "top"

Custom modifier strings are also accepted; just remember to include the leading .:

input().xModel("query", ".debounce.250ms")

Valueless Directives

Use the parameterless overloads for directives Alpine allows without values:

// Renders x-data
div().xData() { ... }

// Renders x-transition
div().xTransition() { ... }

Boolean-style directives only render when true:

// Renders x-cloak
div().xCloak(true) { ... }

// Does not render x-cloak
div().xCloak(false) { ... }
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 59 5/1/2026
0.1.0 78 4/28/2026

Included documentation file in the package