Files
fn_registry/cpp/functions/core/select.md
T
egutierrez dff0d735c1 feat(cpp/core): primitivas UI estilo Mantine
Anade 9 primitivas reutilizables al registry C++ que replican el comportamiento
de los componentes correspondientes de @fn_library / Mantine v9, todas
estilizadas con tokens_cpp_core (colores Mantine dark + indigo):

- button_cpp_core         (component, pure)  variantes primary/secondary/subtle/danger + sm/md/lg
- icon_button_cpp_core    (component, pure)  cuadrado 28x28 con glyph centrado + tooltip
- toolbar_cpp_core        (component, pure)  grupo horizontal de acciones con separadores
- modal_dialog_cpp_core   (component, pure)  popup modal centrada + close con Escape
- text_input_cpp_core     (component, impure) InputText con label muted + placeholder
- select_cpp_core         (component, impure) dropdown con label + opcion '(none)' opcional
- toast_cpp_core          (component, impure) notificaciones efimeras + inbox con badge
- tree_view_cpp_core      (component, impure) jerarquia low-level con tree_node_clicked helper
- process_runner_cpp_core (component, impure) tarea en std::thread + spinner inline

Cada primitiva tiene su .md con frontmatter completo (params/output) y se
indexa via fn index. Son la base del primitives_gallery y de cualquier
app fn_ui futura.
2026-04-25 21:25:39 +02:00

1.5 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, tested, tests, test_file_path, file_path, framework, params, output
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports tested tests test_file_path file_path framework params output
select component cpp core 1.0.0 impure bool fn_ui::select(const char* label, int* selected_idx, const char* const* options, int count, bool allow_none = false) Select/dropdown ImGui con label muted, estilo surface+border y opcion '(none)' opcional
imgui
select
dropdown
form
ui
tokens
tokens_cpp_core
false
imgui
false
cpp/functions/core/select.cpp imgui
name desc
label Label mostrado arriba, tambien usado como id (prefijado con ##)
name desc
selected_idx Puntero a int con el indice seleccionado. -1 = ninguno (solo si allow_none)
name desc
options Array de C-strings con las opciones visibles
name desc
count Numero de opciones
name desc
allow_none Si true, aparece '(none)' como opcion inicial con indice -1
true el frame en que la seleccion cambio

select

Label muted + combo estilizado con tokens. Apto para campos de formulario (lang, domain, project parent).

Ejemplo

static int lang_idx = 0;
const char* langs[] = {"go", "py", "ts", "sh", "cpp"};
fn_ui::select("Language", &lang_idx, langs, 5);

// Con opcion "ninguno"
static int project_idx = -1;
fn_ui::select("Project", &project_idx, project_names.data(),
              (int)project_names.size(), true);