Declare is a UI language for you and your AI

(davidtemkin.github.io)

113 points | by ilamont 1 day ago

46 comments

  • saidinesh5 1 day ago
    I think Qt/QML really reached hit sweet spot for me when it comes to describing UIs (ignore if any syntax errors, doing this from memory):

    For eg. compare this:

    ``` Window { textColor: "slategray" property int v: 40

        ColumnLayout {
            id: layout
            anchors.fill: parent
            spacing: 20
    
            Text {
                id: number
                Layout.alignment: Qt.AlignHCenter
                font.pixelSize: 70
                text: v
            }
    
            ProgressBar {
                id: progressBar
                Layout.alignment: Qt.AlignHCenter
      
                value: v/100
                color: v < 50 ? "dodgerblue" : "turquoise"
            }
        }
    
        MouseArea {
            anchors.fill: parent
            onClick: v = (v+20)%100
        }
    } ```

    with Declare:

    ``` App [ textColor = slategray,

        group: View [ x = center, y = center, width = 80%,
            layout: SimpleLayout [ axis = y, spacing = 20 ],
    
            number: Text [ width = 100%, textAlign = center,
                fontSize = 70, fontWeight = bold, text = { "" + v } ],
    
            bar: Gauge [ width = 100%, value = { v },
                tint = { v < 50 ? cool : warm }, accessibilityLabel = "v" ],
    
            hint: Text [ width = 100%, textAlign = center,
                text = "click anywhere to change v" ]
            ],
    
        v: number = 40,
        cool: Color = dodgerblue,
        warm: Color = turquoise,
    
        onClick() { v = (v + 20) % 100 }
        ]
    
    ```
    • ogoffart 21 hours ago
      It lives on in Slint. The syntax is inspired to QML, but statically typed and compiled to native code (no JS engine, no browser). Can be used from different programming languages. https://github.com/slint-ui/slint
      • saidinesh5 21 hours ago
        I actually used to follow Slint back when we used Qt at $DAY_JOB! I learned quite a bit about compilers looking at your repo back then..
    • pennomi 1 day ago
      QML was really something special. I’m sad that type of syntax never really caught on in the wider UI world.
      • demo4567 1 day ago
        Yes. I love Qt/QML. Nothing has replaced it for me since. I find android/ios too hard to read, until Jetpack compose came along and even then. Dart is better
        • andyfilms1 22 hours ago
          It's so interesting how different frameworks appeal to different kinds of people. For me personally, I regret every second I've ever spent writing glue code. The whole signals/slots paradigm killed my desire to use Qt every time I tried it.
    • 0x073 22 hours ago
      Sad that it's similar slow and memory hungry like winui (qtwidget app use 10mb => qml 100mb).

      Additional to it it may have more fps, but feels less snappy.

      I still use it as it's better than electron, but still makes me sad.

      • saidinesh5 20 hours ago
        As good as QML / QtQuick is, I feel like it makes it very easy to create slower applications by creating too many objects, and too many property bindings.. A lot of QtQuick widget libraries made all kinds of mistakes and you end up really sluggish desktop applications.. even though - the fps counter shows 60 fps..

        But I have also seen really well optimized QtQuick applications that ran at 60 fps on a single core imx6 while playing video, applying all kinds of effects on the video...

    • KuhlMensch 20 hours ago
      Hm. Its great.

      I'm happy enough the with xml-based tsx - if only to differentiate between declared structure v.s. expressions.

      Especially (with what I've seen briefly) of Solid v2.

      But I'm sure I could get used to the above quick.

  • abrookewood 1 day ago
    The LLM language is pretty off putting: "Say what you mean. Exactly" and then in the code comments "// One value, v, and three things that follow it". It's such an awful way of writing.
    • ShinyLeftPad 1 day ago
      It's so out of place in open source. I hope people get fed up with this marketingspeak soon and straight old-school websites get trendy again.
    • Syzygies 23 hours ago
      I managed to train my agents to comment in my style. It was hard work; one has to stay on it. Judge here the human's lack of effort, not the untrained dog.

      The hardest similar problem I've faced was teaching agents aesthetics for a drawing style. What worked: I hand-engineered an interpretable feature space for SVG diagrams, and used the feature vectors of exemplars as the style target for generation. The agents then wrote code one-shot that drew as I liked.

      AI is a kit, not a car where you turn the key. We're all facing the same issues, and many of us are constantly engineering infrastructure to "fix" AI to our needs. Consensus forms fast, and much of this engineering becomes available out of the box if one instead just waits a few months. Reification of state between sessions is the big one we all used to do by hand, that's now standardized.

      Feature spaces would work for teaching comment and writing styles. Try it!

      • pavel_lishin 21 hours ago
        It sounds like you changed your style to sound more like AI.
      • dallen33 23 hours ago
        Bro this sounds like AI.
        • Syzygies 17 hours ago
          These are the correct terms for the math, and the same math is behind AI.

          Before I fixed my language, my original was "A key component of LLMs is a semantic embedding into a large vector space. I struggled with teaching LLMs aesthetic judgement, and what worked was building hundreds of sensors to measure aspects of an SVG diagram, and embed art that I liked into a corresponding vector space. Then I could tell an LLM coding agent "draw like this!" and it could, one-shot."

        • frizkie 22 hours ago
          You don’t say
    • triyambakam 1 day ago
      Yes, it's definitely Claude and so dumb. More GPT models seem to do this less. But unfortunately Claude is just otherwise so much better lately.
    • mattbettinson 23 hours ago
      I call them "corporate mic drop moments". It's punctuated like that at the end of every paragraph and its so grating
      • abrookewood 12 hours ago
        Yeah, it's a good description. Everything has to sound dramatic.
    • bensyverson 1 day ago
      I wish I had a name for the "One value, and three things that follow it" construction. I think the model feels it's being dramatic, but it's borderline nonsense.

      "Two vectors, and the one invariant that binds them." WHAT ARE YOU TALKING ABOUT

      • topicalSoup 1 day ago
        There actually is a name for this: “mannered prose”. It’s terrible.
        • bensyverson 22 hours ago
          That's the umbrella term, but I want a name for "seventeen of them, and two are never true"… As if the model has to pay for nouns.
      • abrookewood 12 hours ago
        I'm soo sick of hearing it.
      • qingcharles 20 hours ago
        One invariant to rule them all, and in the darkness bind them.
  • mapcars 1 day ago
    Not sure how it supposed to be used. Its a whole new language with its own constructs and rules, no training data for LLMs to use it well, syntax is questionable, and as much as it tries to stay declarative its already clear that it can't: onClick() { v = (v + 20) % 100 }

    At this point I don't see any pros compared to any existing reactive framework.

    • hungryhobbit 21 hours ago
      Exactly, to any React dev JSX is much clearer than this.
  • TonyAlicea10 1 day ago
    It's extraordinary to me how many people are ok with having horrific Claudish fill the landing pages for their projects.

    For now, I would urge project creators to start using Neon for writing docs and landing pages. It's significantly better out of the box.

    • hasbot 1 day ago
      For those that don't know, "Neon" refers to "Gemini 4 Neon." https://blog.google/innovation-and-ai/models-and-research/ge...
    • ricardobeat 23 hours ago
      Absolutely, just used Neon to rewrite a ton of comments and docs and they are so much better. Neon + diataxis [1] produced documentation indistinguishable from human writing.

      Meanwhile, Claude has become immune to skills that try to tame its writing style. I think they’re prioritizing preventing distillation vs their own product UX, which is a shame.

      [1] https://diataxis.fr/

      • mamcx 22 hours ago
        how combine with diataxis?
        • ricardobeat 14 hours ago
          Just point to the website, no skill file needed.
    • talmr 22 hours ago
      As soon as I see that I just quit the tab.

      I don’t think it is worth giving my agent to peruse either, because it will get poisoned.

      Hard skip. And maybe even block.

      • stronglikedan 21 hours ago
        > As soon as I see that I just quit the tab.

        Claude has ruined Solarized for me. As soon as I see that theme (light or dark), I quit the tab. I don't even need to start reading.

        • talmr 20 hours ago
          Ha! I have used solarized theme since I was a kid, for my editors, terminals, even my OS theme.

          I am making some software currently which has a solarized background but white containers on top.

          The claude solarized + burnt orange is quite unpleasant, however.

    • qingcharles 20 hours ago
      +1 for Neon. Its writing is a step above the others. It's still AI, but it's better AI.
  • mtford 1 day ago
    First contact marketing pages and core documentation should be written by a human. This sounded interesting but my eyes glazed over as soon as I detected the AI smell...
    • altern8 1 day ago
      Same here. They couldn't be bothered to write a couple of pages of text..?
      • iamflimflam1 1 day ago
        It’s amazingly difficult for people to throw away AI generated text and redo it. I think we still feel sunk cost even when there isn’t any.
        • bombdailer 21 hours ago
          It's more that AI writing poisons the brain and prevents the flexion of ones own judgment and creativity. It forms a kind of foundation which is difficult to throw away since it biases your thoughts towards the AI prose, and because people put so little comparative effort into anything created with AI, they do not feel the sense of ownership and accomplishment that comes from having created something themselves, so the effort required to rework the prose is too great for atrophied minds.

          If one starts with AI text, it is like seeding their mind with already completed details, and so they cannot see anything beyond the pre-existing structure it has created for them. One has to start from a blank slate to avoid this fate.

        • cyanydeez 1 day ago
          Is it sunk cost or the dreaded realization your product will never be consumed by humans. At best, it'll be a LLM mediated inspection. Why then would you want to speak to this supposed human when Claude is both the reader and writer.

          Anyway, it's probably more existential dread than laziness. Y'all just gonna point your LLM at it in real world use.

          • iamflimflam1 1 day ago
            That is a fair point. “An AI is going to read this anyway -it’s good enough” is probably quite valid nowadays.
            • paulhebert 22 hours ago
              You would let an AI agent choose a brand new UI language for your project without reviewing yourself?
              • cyanydeez 13 hours ago
                If it let you specify very acutely what you want build, I'm pretty sure people would say yes.

                Even with vision models, they have no real good clue about ui.

  • samrus 1 day ago
    The claudish here got unreadable after a while. The project's thesis really should be written by a human. Shame becuase it seems like an interesting idea
  • skybrian 1 day ago
    This looks quite nicely done. I'm reluctant to try it solely because the website has so much marketing-style writing (probably AI-generated) and I'm not sure I want to read more of it.

    It should probably say up front that this is an npm package along with the tooling for it, and the output runs in a browser.

    • onemoresoop 1 day ago
      There's a disclaimer of sorts right on this webpage:

      "This page is written in it. By an LLM."

      • lopatin 1 day ago
        It’s not about whether or not it was disclosed. It’s the lack of effort and craftsmanship which gives it away as something not worth our time if the authors themselves didn’t put their time in.
        • davidtemkin 20 hours ago
          (project builder here) I'll own up to the marketing-y prose on the homepage. Lesson learned. And yes there is AI prose / locution / diction there. Apologies.

          But, there's a lot of actual craftsmanship in the project. (Or at least it's taken real work and thinking over a long period of time; you be the judge).

          Do take a look at the FAQ, and "Why" under "Learn", you might find things you like. And the calendar example too.

          I fell into a bit of a trap on the prose, which is ironic considering I've edited actual publications and been a journalist... years ago

          • skybrian 18 hours ago
            The deeper web pages have a lot of marketing-style short sentences too, and that's where I normally go to get away from the marketing. Overall it's good content, but the prose style needs some editing.

            It seems like a lot to rewrite, though? I haven't been able to get an LLM to generate prose I like, but I haven't tried that hard and perhaps it's possible with other models?

  • davidtemkin 20 hours ago
    Ok this is my project.

    Appreciate the reactions - and ahem , point very much taken on marketing-y prose and admittedly (some) AI prose diction in sections. Bad on me.

    All that being said there is actual depth here, it’s not a thin layer over React. Even if you have no interest in agent-driven coding - but are interested in front end dev - I think you’ll find some interesting bits. The language and framework allow a lot in the way of design expressiveness without escape hatches. The component library is self-hosted. Animation built on fine grained constraints. Accessibility. Runs on DOM or without DOM.

    And yes it is typed.

    Btw if you happen to remember a language / framework called OpenLaszlo … from many years back — this is a sort of successor. I co-founded the company that created that project.

  • cryptos 1 day ago
    I like the idea somewhat, however, I have the vague feeling that it is not really simpler than actual UI frameworks like Vue.js or Compose[1]. My assumption is that a real framework is even better for AI.

    [1] https://kotlinlang.org/docs/multiplatform/compose-multiplatf...

    • KolibriFly 1 day ago
      Real frameworks also give Ai agents a massive advantage in tooling - mature typecheckers, linters, and test runners. When an agent edits Compose or TypeScript React, it gets super clear feedback loops to self-correct, which is hard to match in a brand-new DSL

      Honestly, Jetpack Compose and SwiftUI already nailed concise declarative UI, and they have the huge advantage of living inside full-blown languages like Kotlin and Swift so you don't hit a wall when logic gets complex

      • davidtemkin 20 hours ago
        The language and tools here are very much adapted to LLMs. The error messages, the verification process, etc -- all optimized for AI use. It's counterintuitive but having a language that an LLM learns from context vs pre-training has some advantages. The language itself was shaped by watching the evals and where it broke.

        A more closed language would be even more effective on this dimension but I didn't want to give up expressiveness / ability to make truly custom UX. That's been a big part of this project...

        (this is my project...)

  • silok 1 day ago
    • davidtemkin 20 hours ago
      Related. This one is more geared toward open-ended fine-grained custom design...
    • owebmaster 1 day ago
      Never heard of a2ui from Google. That's great! (The fact that it got ignored just like A2A).
  • piterrro 1 day ago
    Interesting project, few ideas on the landing page:

    - Move docs to llms.txt too

    - Make one click copy prompt button for starting with an agent

    - Explain clearly how it can integrate with React or Vue - if I can embed a module in my already existing app - thats a great way to transition over time.

    - Play the “Agent” card more - these days nobody will learn new DLL, but having a way to quickly test it with my agent would convince more people to give it a try

  • GrollingGrakbor 1 day ago
    Looks vaguely interesting. Unfortunately I had to stop reading after 1 minute.
  • joddystreet 1 day ago
    I was working on a similar concept - Morpheus

    Snippet -

    ```

    document ::= ( comment | blank )* screen-line body

    body ::= ( element-line | comment | blank )*

    element-line ::= indent kind [ name ] meaning* [ modifiers ]

    ```

    • joddystreet 1 day ago
      This was take 2

      ```

      document = { template } ;

      template = "@template", identifier, newline, { node }, "@end", line-end ;

      node = group | row ;

      group = "<", identifier, ">", newline, { node }, "</", identifier, ">", line-end ;

      row = atom, { "|", atom }, line-end ;

      atom = reference | component | spacer ;

      reference = "[[", identifier, "]]" ;

      component = "[", label, [ "|", identifier, { "|", property } ], "]" ;

      property = identifier, "=", value ;

      value = json-scalar | binding ;

      label = label-part, { label-part } ;

      label-part = literal-text | escape | binding ;

      binding = "{", identifier, { ".", identifier }, "}" ;

      spacer = "..." ;

      line-end = newline | end-of-file ;

      ```

      Still evolving.

      Core idea is to be able to define interfaces in a minimal language, without going into too much details about attributes, say height, width, etc

    • verdverm 1 day ago
      Myself too, they are all essentially DSLs with a transpiler to underlying tools and packages in a given language. Mine is different by allowing module developers to control the output technologies and DSL if they want, boiled down to CUE + text/template. Downstream users get a similar experience to this post.
      • joddystreet 1 day ago
        • verdverm 17 hours ago
          Both of those are too much DSL (imo). My approach involved no business logic, because that never works out, and focussed on generating/maintaining boilerplate, while also allowing users to modify the generated code and have it survive regen (diff3)

          https://hofstadter.io/code-generation/

          I'm migrating / renaming / cleaning up the project this week

          https://github.com/verdverm/veg

      • joddystreet 1 day ago
        My focus was essentially to be able to define this and let agents use these to build the interfaces. This `...with a transpiler to underlying tools and packages in a given language.` is an interesting idea, but I just want to focus on the language specs and compiler.
        • verdverm 17 hours ago
          > but I just want to focus on the language specs and compiler

          I'm using "a transpiler" loosely to cover when the input is a DSL and output is something like react, tanstack, node - but tech choices are flexible here

  • fleur-de-lotus 1 day ago
    Can this be used as a front-end to an app written in another language or can it call code written in another language?
  • agnishom 1 day ago
    What has this got to do with AI? I like declarative frameworks, but why is this one special for AI?
  • chr15m 1 day ago
    If you think this looks good, you should see Hiccup and Reagent.
  • moralcoral 1 day ago
    Hyperscript ... anyone?
  • sroerick 1 day ago
    This seems very well executed and solves a ton of the problems I've seen in UI with agents so far.
  • dudhatprakash99 1 day ago
    Ah another language!!! By this time, AI already trained on billions of line of javascript code for UI. so this language have to compete with that knowledge base. It'll be really exciting to see how quickly AI agents can build the UI for same problem using `Declare` as compared to any javascript framework (React).
  • DeathArrow 1 day ago
    >Just as SQL is a domain-specific language for database queries, Declare is a DSL for user interfaces

    Isn't HTML a DSL for UI? What's wrong with it?

    • voiper1 1 day ago
      This is an abstraction, like any other library/front end is one layer up on HTML.
    • mejutoco 1 day ago
      It is not typed
    • zaphirplane 1 day ago
      there must be a reason there are so many css libraries and UI frameworks
  • HexDump0 1 day ago
    Not to hate, but I feel like we are just reinventing the "slop" wheel. LLMs are already pretty good that they don't need another "Language for AI" limiting them
  • Noamc0405 1 day ago
    interesting. What can it do?
  • mllev15 1 day ago
    It’s REBOL for the web. This is what you get when you don’t realize what your LLM is ripping off.
  • designerarvid 1 day ago
    When are those switches in the tutorial on or off? And what do they do?

    “Show boxes”?

    UI used to strive for making it easy for users to understand the software’s mental model, current state, and possible actions. Now it’s about looking cool (the same as the other cool kids).

  • efskap 1 day ago
    The cursed green claude dot is now following my cursor for pete's sake
    • rogual 1 day ago
      What even is that thing? I can't figure out what stylistic or functional purpose it's supposed to serve.
      • cobbal 22 hours ago
        Before it was the claude dot, it was commonly seen on "Live" indicators for video streams and other real-time information. It indicated an active connection to some sort of server. That's my guess where it came from, and then it got RLHF'd into overuse because who wouldn't want their website to be more dynamic and real-time?
  • mysterydip 23 hours ago
    I find the copyright notice at the bottom of the page particularly humorous given the page itself states it was all written by an LLM
  • jauntywundrkind 1 day ago
    Heximal looking very interesting on this front. A DOM-ish like system but wasm-driven, wasm-homed. Already virtualized out of the real dom.
  • etchalon 1 day ago
    I just have a hard time with anyone who thinks you can make good UIs this way. "Declarative" UI has been tried, multiple times. It does not produce interesting UIs. It produces derivative, limited UIs that require deeply weird hacks to handle novel problems.

    XAML was a notoriously bad idea.

    This doesn't look much better than that.

  • vanillax 15 hours ago
    AI blue still looks like terrible AI blue.
  • altern8 1 day ago
    Site looks pretty bad, with the classic AI gradients and 01, 02, 03 lists.

    Language is extremely annoying.

    I hate it

  • mehmetkose 1 day ago
    Anything related with UI makes me expect more than a slop look
  • zobzu 1 day ago
    neat
  • boxed 1 day ago
    It's not a UI language though, it's a typescript specific tooling system?
  • jarym 1 day ago
    [flagged]
  • coffeebreak_py 1 day ago
    [flagged]
  • KolibriFly 1 day ago
    [flagged]
  • ttalkkakman 1 day ago
    [flagged]
  • OJFord 20 hours ago
    [dead]
  • ZeroDayDreamer 1 day ago
    [flagged]
  • aicanvasme 23 hours ago
    [flagged]
  • DonHopkins 23 hours ago
    [dead]
  • koteelok 1 day ago
    [flagged]
  • lofaszvanitt 1 day ago
    [flagged]