https://github.com/bjornpagen/carbon-go
carbon design implementation in pure go: great with htmx
https://github.com/bjornpagen/carbon-go
carbon-design-system components go golang ssr
Last synced: 2 months ago
JSON representation
carbon design implementation in pure go: great with htmx
- Host: GitHub
- URL: https://github.com/bjornpagen/carbon-go
- Owner: bjornpagen
- License: apache-2.0
- Created: 2023-08-21T04:00:18.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-31T00:22:33.000Z (over 1 year ago)
- Last Synced: 2025-01-23T06:12:56.597Z (4 months ago)
- Topics: carbon-design-system, components, go, golang, ssr
- Language: CSS
- Homepage: https://carbon-go.io
- Size: 159 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# carbon-go
https://carbon-go.io
every component implements the `carbon.Component` interface:
```go
type Component interface {
Render(w io.Writer)
Attr(name, value string) Component
}
```so, you can use it to write to anything that implements `io.Writer`. use in a server like this:
```go
type foo struct {}func (f *foo) ServeHTTP(w http.ResponseWriter, r *http.Request) {
carbon.Button("Hello world!").Render(w)
}
```put HTMX tags on your component like this:
```go
carbon.Button("Hello world!").Attr("hx-get", "https://example.com").Attr("hx-swap", "outerHTML").Render(w)
```---
currently documentation sucks. just look at the docs for [carbon design svelte](https://carbon-components-svelte.onrender.com/).
i've tried to keep it as similar as possible. moving forward,
we should try to keep upstream with the react version when possible. i just didn't want to comb through react code.will be adding doc comments.
TODO:
- implement the rest of the components (copy button, textarea, etc...)
- implement client side javascript for a few components
- import icons on the fly and cache them server side instead of hardcoding them
- automated testing against the react implemention to ensure markup generation parity
- make every single component respect class Addr