How to register a Livebook smart cell with "sub types"?

Is there any way to register a smart cell with Kino.SmartCell.register/1 such that it appears as a “subelement” of the list?

(eg. like MySQL under Database Connection)

After reading Livebook’s source code I understand these initial cells are registered differently, but I can’t find if that mechanism is exposed for 3rd party cells.

Any resources on smart cell development are greatly appreciated!

Hey @beltranaceves : ) There is currently no API to do that, note that currently we show the variants only if the given smart cell is not installed. Once you add “Database connection” once, we no longer show these options, but there is a select for database type in the smart cell, and if you pick a different database we show a message about a missing package. Can you please provide more context on your use case?

Oh yeah, I hadn’t noticed they do disappear. Thanks for the response!

I’m trying to build a collection of smart cells that configure phx.gen commands as part of a templating/docs system withing Livebook for a uni project.

At the moment I’m handling it in a single cell with a select that changes the form depending on the element it generates, but it would have been pretty sweet if that “cell variant” selection was available :slight_smile:

The select sounds good. The reason we do variants for “Database connection” is because each database requires different dependencies, so we want to add the necessary dependency upfront, rather than install the smart cell, let the user select the database and only then ask them to add the corresponding dependency.

We may expand the API in the future, once we have more use cases : )