• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • Weโ€™re hiring!
Log inSign up
project logo

jxnblk

tuna

Simple functional CSS library for Val Town
Public
Like
tuna
Home
Code
13
.vim
1
proto
4
README.md
atomic.tsx
cache.tsx
create-declaration.tsx
create-media-rule.tsx
create-nested-rule.tsx
create-raw-rule.tsx
create-rule.tsx
main.tsx
notes.md
H
test-suite.http.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data โ€“ all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
https://jxnblk--490d8054010f11f09bc3569c3dd06744.web.val.run
README.md

tuna (WIP)

NOTE: this was ported over from another val and may not be fully working

๐ŸŸ Simple CSS library for Val Town

Create val
import { css } from "https://esm.town/v/jxnblk/tuna/main.tsx"; const styles = css({ body: { // special keyword for <body> element fontFamily: "system-ui, sans-serif", margin: 0, backgroundColor: "#f5f5f5", }, container: { padding: 32, // numbers are converted to pixel units margin: "0 auto", maxWidth: 1024, }, input: { fontFamily: "inherit", fontSize: "inherit", lineHeight: "1.5", padding: "2px 8px", border: "1px solid #ccc", borderRadius: "4px", }, });
Create val
// JSX example const html = render( <div className={styles.container}> <style {...styles.tag} /> <h1>Tuna Example</h1> <input type="text" defaultValue="hi" className={styles.input} /> </div> );
Create val
// get raw CSS string styles.css

Nested selectors and pseudoselectors

Create val
const styles = css({ button: { background-color: "tomato", "&:hover": { background-color: "magenta", }, "& > svg": { fill: "currentColor", }, }, });

Media queries

Create val
const styles = css({ box: { padding: 16, "@media screen and (min-width: 768px)": { padding: 32, "&:hover": { color: "tomato", }, }, } });

Limitations

  • Does not support HTML element selectors (other than body)

Tests: https://www.val.town/v/jxnblk/tuna_tests

HTTP
  • http.tsx
    jxnblk--490d8054010f11f09bc3569c3dd06744.web.val.run
  • test-suite.http.tsx
    jxnblk--77โ€ฆ44.web.val.run
Code
.vimprotoREADME.mdatomic.tsxcache.tsxcreate-declaration.tsxcreate-media-rule.tsxcreate-nested-rule.tsxcreate-raw-rule.tsxcreate-rule.tsxmain.tsxnotes.md
H
test-suite.http.tsx
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
Weโ€™re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
ยฉ 2025 Val Town, Inc.