Note: This hack is no longer necessary! Custom widgets and plugins are here! Take a look at the support article and get involved in the developer program. The use cases are endless… have fun!
------- original post below-----
Here is a neat little hack for how you can use SVGs and connector functions to make dynamic custom gages or images.
Yep! It is a sql connector that returns an image variable. The image itself is created within the function and can accept variables that help to define the size, color, or shape of the image.
Hey everyone, just wanted to give a quick update - the new function STRING_TO_IMAGE_URL() within the expression editor makes it so you no longer need to use the connector to accomplish this.
This is great and will allow so much more control for guys like me that focus more on the UX side of an app. Will this feature need to be enabled for each Tulip instance?
New features are documented in the support docs (Technical Details of the Expression Editor | Tulip Knowledge Base - Support for Building Operations Apps) but I like to push the features and the platform whenever possible. I would still generally regard the SVG and base64 stuff as a Hack. Personally though, I like hacks. I’m always impressed by what people come up with and I don’t think we’ve fully explored all that is possible. The simplicity, power, and diversity of the platform’s features make me wonder if we’ll ever fully document every possibility. The more we explore and share, the better.
For this, at least, I’ll be making an updated video that uses the expression editor (instead of the connectors demo) and exploring what can be done with it. What I’d like to continue to do is document as many tricks, tips, techniques, and solutions that I can and categorize them.
I just realized looking at r216 that we can encode a SVG code from the expression editor (with Encode_URI() ) so here is an app builder friendly expression :
@freedman exciting and a bit of a game changer for ux design in Tulip, thanks for sharing! Is there any plan or hack to store the “value” of an image variable like this in a Tulip Table? Like in pte’s example above, except the image of the square is stored in a tulip table vs. a local app variable (and thus updates wherever referenced in other apps)? Thanks!
Interesting @aaronbroussard , I’d be curious what you had in mind here. I’m sure that would be very useful. I tried saving to a table and got an error so I just submitted a feature request.
It does seem to work in test / dev mode, but that doesn’t really help that much.
In the short term you could just store the raw text in a table and update the image variable from the tulip table on app open/step open or on a timer.
Does anyone know why gradients in an svg do not display? Most modern UX design styles such as Flat 2.0 and Neumorph rely heavily on gradients and it would be great have more options and abilities than just the drop shadow effect on text boxes and buttons.
@Hoss1 I haven’t made a new video but the process is a few steps simpler when using the expression editor. Let’s use @pte 's example from above. Just create the variables that you want to use to adjust the image (shown in the image below as blue)
Having tested both now, i actually prefer the connector method. Yes its a few more steps to create, but once done its much easier to plug the variables in via the action dropdowns than edit the expression code.