Declare is a UI language for you and your AI

(davidtemkin.github.io)

92 points | by ilamont 14 hours ago

43 comments

  • saidinesh5 11 hours 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 26 minutes 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
    • 0x073 56 minutes 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.

    • pennomi 3 hours ago
      QML was really something special. I’m sad that type of syntax never really caught on in the wider UI world.
      • demo4567 2 hours 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 1 hour 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.
  • abrookewood 11 hours 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 3 hours 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.
    • triyambakam 10 hours 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.
    • Syzygies 2 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!

    • mattbettinson 2 hours ago
      I call them "corporate mic drop moments". It's punctuated like that at the end of every paragraph and its so grating
    • bensyverson 4 hours 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 2 hours ago
        There actually is a name for this: “mannered prose”. It’s terrible.
  • mapcars 2 hours 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 26 minutes ago
      Exactly, to any React dev JSX is much clearer than this.
  • TonyAlicea10 4 hours 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 3 hours ago
      For those that don't know, "Neon" refers to "Gemini 4 Neon." https://blog.google/innovation-and-ai/models-and-research/ge...
    • talmr 1 hour 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 35 minutes 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.

    • ricardobeat 2 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 45 minutes ago
        how combine with diataxis?
  • mtford 12 hours 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 9 hours ago
      Same here. They couldn't be bothered to write a couple of pages of text..?
      • iamflimflam1 8 hours 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 8 minutes 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 6 hours 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 3 hours ago
            That is a fair point. “An AI is going to read this anyway -it’s good enough” is probably quite valid nowadays.
            • paulhebert 49 minutes ago
              You would let an AI agent choose a brand new UI language for your project without reviewing yourself?
  • samrus 11 hours 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 12 hours 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 11 hours ago
      There's a disclaimer of sorts right on this webpage:

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

      • lopatin 9 hours 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.
  • cryptos 9 hours 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 8 hours 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

  • GrollingGrakbor 9 hours ago
    Looks vaguely interesting. Unfortunately I had to stop reading after 1 minute.
  • piterrro 9 hours 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

  • silok 8 hours ago
    • owebmaster 7 hours ago
      Never heard of a2ui from Google. That's great! (The fact that it got ignored just like A2A).
  • joddystreet 12 hours 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 11 hours 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 12 hours 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.
  • fleur-de-lotus 10 hours 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?
  • dudhatprakash99 2 hours 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).
  • agnishom 12 hours ago
    What has this got to do with AI? I like declarative frameworks, but why is this one special for AI?
  • chr15m 9 hours ago
    If you think this looks good, you should see Hiccup and Reagent.
  • HexDump0 2 hours 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
  • moralcoral 10 hours ago
    Hyperscript ... anyone?
  • sroerick 9 hours ago
    This seems very well executed and solves a ton of the problems I've seen in UI with agents so far.
  • DeathArrow 11 hours 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 9 hours ago
      This is an abstraction, like any other library/front end is one layer up on HTML.
    • mejutoco 10 hours ago
      It is not typed
    • zaphirplane 10 hours ago
      there must be a reason there are so many css libraries and UI frameworks
  • jauntywundrkind 10 hours 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.
  • mysterydip 2 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
  • mllev15 10 hours ago
    It’s REBOL for the web. This is what you get when you don’t realize what your LLM is ripping off.
  • designerarvid 11 hours 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).

  • koteelok 12 hours ago
    Next time you try to build a UI tech, make sure your site isn't ugly.
  • efskap 10 hours ago
    The cursed green claude dot is now following my cursor for pete's sake
    • rogual 9 hours ago
      What even is that thing? I can't figure out what stylistic or functional purpose it's supposed to serve.
      • cobbal 1 hour 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?
  • etchalon 10 hours 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.

  • altern8 9 hours ago
    Site looks pretty bad, with the classic AI gradients and 01, 02, 03 lists.

    Language is extremely annoying.

    I hate it

  • mehmetkose 8 hours ago
    Anything related with UI makes me expect more than a slop look
  • Noamc0405 9 hours ago
    interesting. What can it do?
  • zobzu 12 hours ago
    neat
  • boxed 11 hours ago
    It's not a UI language though, it's a typescript specific tooling system?
  • jarym 4 hours ago
    [flagged]
  • coffeebreak_py 3 hours ago
    [flagged]
  • aicanvasme 2 hours ago
    [flagged]
  • KolibriFly 8 hours ago
    [flagged]
  • ttalkkakman 12 hours ago
    [flagged]
  • ZeroDayDreamer 8 hours ago
    [flagged]
  • DonHopkins 1 hour ago
    [dead]
  • lofaszvanitt 12 hours ago
    [flagged]