shadcntempl

package module
v0.0.0-...-267ff11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2025 License: MIT Imports: 3 Imported by: 0

README

⚠️ This project is not maintained

This project is currently unmaintained, and not in a really usable state; sorry for any incovenience this might cause :)

If you want to maintain and/or develop this project and would like to be added as a collaborator, or you have any insights, feel free to contact me at <horesh.rotem at gmail.com>.


Shadcn/ui port for Go + Templ + Alpine.js + Tailwind CSS

Go Reference Go Report Card

Note

The codebase is going through a change in structure, so it's currently a bit messy

This is a work in proccess.

  • Not all the components from shadcn/ui are implemented.
  • There are refinements needed for some of the components - alpine.js naming, unfinished accessibility, improvements I want to make, etc.
  • Some components might contain behavior that existed for previous needs (I detached the developement of this from another project). Hopefully will be fixed in the future.

Overview

A shadcn/ui port using Go, Templ, Alpine.js and Tailwind CSS.

Components

issue.

Roadmap
  • Adding all the components from shadcn/ui
  • Making sure the components are of good quality: Accessibility, Correct functionality, Style, etc.
  • Creating a CLI to have a flow similar to shadcn's.
Usage

You have to include the Head component in your head tag (it includes the neccessery scripts - Alpine.js and a theme script). You have to serve the CSS var and link to it in your head tag.

Example:

router.HandleFunc("GET /static/css/styles.css", func(w http.ResponseWriter, r *http.Request) {
  w.Header().Set("Content-Type", "text/css")
  w.Write(shadcntempl.CSS)
})
templ Layout() {
  <!DOCTYPE html>
	<html lang="en">
		<head>
			// ...
			@shadcntempl.Head()
			<link rel="stylesheet" href="/static/css/styles.css"/>
		</head>
		<body>
			{ children... }
		</body>
	</html>

}
Example

Use in .templ files.

import "github.com/rotemhoresh/shadcn-templ/ui/button"

templ Page() {
  @button.Root(button.RootProps{}) {
    Click me
  }
}
Design

The components props (parameters) is structures like this:

type Props struct {
  <COMPONENT_SPECIFIC_PROPS>
  p.CoreProps // Class and Attrs 
}

For example, the button.Root's props:

type RootProps struct {
	Type    Type    // default: [TypeButton]
	Variant Variant // default: [VariantDefault]
	Size    Size    // default: [SizeDefault]
	p.CoreProps
}

The components are written with constant referencing to the shadcn/ui source code and the underlying radix components.

Contributing

Contributions are welcome for both new components and improvements for existing ones.

Make sure to read the README and go over the codebase to understand the design choices and overall coding style as well as getting familiar with shadcn/ui.

License

MIT

Documentation

Overview

templ: version: v0.2.778

Index

Constants

This section is empty.

Variables

View Source
var CSS []byte

The compiled CSS used in this module.

You need to include a path that serves this in your head tag.

Functions

func Head() templ.Component

Tags to include in the head of your page.

Types

This section is empty.

Directories

Path Synopsis
templ: version: v0.2.778
templ: version: v0.2.778
dialog
templ: version: v0.2.778
templ: version: v0.2.778
portal
templ: version: v0.2.778
templ: version: v0.2.778
ui
templ: version: v0.2.778
templ: version: v0.2.778
aspect-ratio
templ: version: v0.2.778
templ: version: v0.2.778
button
templ: version: v0.2.778
templ: version: v0.2.778
dialog
templ: version: v0.2.778
templ: version: v0.2.778
progress
templ: version: v0.2.778
templ: version: v0.2.778

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL