TailwindSQL

Like TailwindCSS, but for SQL. className your way to database queries!

React Server ComponentsSQLiteZero RuntimeType Safe*
<DBclassName="db-users-name-where-id-1"/>
→ Renders: Vint Torvalds

Syntax Reference

db-{table}-{column}-where-{field}-{value}-limit-{n}-orderby-{field}-{asc|desc}

Interactive Playground

Type a TailwindSQL query and see results update in real-time

<DBclassName=""as=""/>

More Examples

Different ways to query and render data with TailwindSQL

Get User Name

Fetch a single user's name by ID

<DBclassName="db-users-name-where-id-1"/>
Output
Vint Torvalds

Product List

Display products as an unordered list

<DBclassName="db-products-title-limit-5"as="ul"/>
Output
  • Essential Headphones 1
  • Smart Hub 2
  • Smart Desk 3
  • Ultra Microphone 4
  • Elite Headphones 5

Top Posts by Likes

Posts ordered by popularity

<DBclassName="db-posts-title-orderby-likes-desc-limit-3"as="ol"/>
Output
  1. Why AI is the Future of Edge Computing
  2. The State of GraphQL in 2024
  3. The State of GraphQL in 2024

Users with Posts (JOIN)

Join users with their posts

<DBclassName="db-users-name-limit-5"as="table">
<Jointable="posts"on="id-author_id"select="title"/>
</DB>
Output
Vint Torvalds, Sheryl Knuth, Bjarne Pichai, Sergey Zuckerberg, Brendan Allen