8

This is a question regarding the frontend framework Slint

Let's take a web frontend framework as an example like React, Vue, Svelte, and so on. They allow you create components with their own distinct logic and expose an interface with which parents or siblings can react.

(I don't actually write Vue, this is just an example from memory)

<script>
let status = ref("Unknown");
async function onClick(){
  let result = await fetch("https://somewhere.org/");
  status.value = result.json()?status;
  emit("status", status);
}
</script>
<template>
<button @onClick="onClick">Check status</button>
<p>{{ status}}</p>
</template>

How can this be achieved in slint + another language (cpp, python, rust, ...)?

Say, I'm writing a desktop application and have a window, with a 3 column layout, and somewhere deep in the component tree, I have a StatusButton. This button, upon clicking is supposed to execute an IO call in my language of choice and its parent component should react to that. For the sake of the example, make it an HTTP network request that calls a server, expects a JSON with a status field.

How do I create the StatusButton component and use it in slint?

For what it's worth, I use rust, but whichever language the solution is presented in, it can probably be adapted to work in rust.

What I've found (that doesn't work)

slint::slint!( some slint in here ) in rust. This just moves the .slint file into rust but I haven't found out how to use the new component in a .slint file or in another slint::slint!(...) macro

The examples seem to suggest that any non-slint actions have to be passed all the way up to the main component / app window (see example)

Maybe @slint@fosstodon.org can help?

no comments (yet)
sorted by: hot top new old
there doesn't seem to be anything here
this post was submitted on 08 Feb 2026
8 points (90.0% liked)

Programming

25415 readers
273 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS