Compose Adapters
The catalogued composables KBC can render today. IDs come from
dev.ketoy.bytecode.KBCAdapterIds. Standard adapter IDs are
0x0001–0x3FFF; app-specific are 0x4000+.
For the how-to (writing a new adapter, scan-roots directives, the KSP pipeline), see Custom Adapter.
Catalogued (fully routed end-to-end)
Every entry below is generated by the KSP processor reading
adapter-scan-roots.txt. The runtime resolves these by ID; the
compiler plugin uses ComposeAdapterCatalog (the
KSP-emitted binary) to validate calls.
| ID | FQ Name | Notes |
|---|---|---|
0x0001 | androidx.compose.material3.Text | 15-param canonical String overload (post-1.5; minLines at pos 14). softWrap/maxLines/minLines use paramHonourDefault + coerceAtLeast(1) transform. |
0x0002 | androidx.compose.foundation.layout.Column | modifier, verticalArrangement, horizontalAlignment + content slot. |
0x0003 | androidx.compose.foundation.layout.Row | modifier, horizontalArrangement, verticalAlignment + content slot. |
0x0004 | androidx.compose.foundation.layout.Box | modifier, contentAlignment, propagateMinConstraints (default false). |
0x0007 | androidx.compose.material3.Scaffold | Full Material3. Content slot resolves through getPaddingValuesContentSlot. |
0x0008 | androidx.compose.material3.Surface | Non-clickable overload (the clickable overload is explicitly excluded). |
0x0009 | androidx.compose.material3.Card | 6-param non-clickable overload. colors, elevation built via CardDefaults.cardColors / cardElevation constructor adapters. |
0x000B | androidx.compose.foundation.layout.Spacer | modifier only — width/height live on the modifier chain (Modifier.height(20.dp)). |
0x000C | androidx.compose.material3.Button | onClick, enabled (honourDefault), colors, elevation, border, contentPadding, interactionSource, content. |
0x000F | androidx.compose.material3.IconButton | onClick, modifier, enabled (honourDefault), colors, interactionSource, content. |
0x0012 | androidx.compose.material3.TextField | String overload picked explicitly. Full param list — see source. |
0x0014 | androidx.compose.material3.Checkbox | checked, onCheckedChange, modifier, enabled (honourDefault), colors, interactionSource. |
0x0016 | androidx.compose.material3.Switch | checked, onCheckedChange, modifier, thumbContent, enabled, colors, interactionSource. |
0x0018 | coil.compose.AsyncImage | 16-arg post-1.x overload. placeholder/error/fallback Painter slots use the UnsupportedFallback (omit-on-default) classifier. |
0x0019 | androidx.compose.material3.Icon | ImageVector overload. Resolved via host-provided KBCImageVectorResolver. |
0x001D | androidx.compose.material3.TopAppBar | Post-1.2 overload with expandedHeight: Dp at position 4. Requires @OptIn(ExperimentalMaterial3Api::class). |
0x0024 | androidx.compose.foundation.Image | 7-param overload with Painter. painter slot uses paramResolver=...painter=getPainter. alignment defaults to Alignment.Center, alpha to DefaultAlpha. |
Reserved (IDs exist, not yet routed)
These IDs are reserved in KBCAdapterIds but adapter-scan-roots.txt
doesn't include them. KBC source referencing them fails with
UnregisteredComposable.
| ID | Component | Blocker |
|---|---|---|
0x0005 | LazyColumn | LazyListScope receiver-typed content lambda needs SlotScope-aware codegen. |
0x0006 | LazyRow | Same. |
0x000A | ElevatedCard | None — open to PR. |
0x000D | OutlinedButton | None — open to PR. |
0x000E | TextButton | None — open to PR. |
0x0010 | FloatingActionButton | None — open to PR. |
0x0011 | ExtendedFloatingActionButton | None — open to PR. |
0x0013 | OutlinedTextField | None — open to PR. |
0x0015 | RadioButton | None — open to PR. |
0x0017 | Slider | None — open to PR. |
0x001A | HorizontalDivider | None — open to PR. |
0x001B | CircularProgressIndicator | None — open to PR. |
0x001C | LinearProgressIndicator | None — open to PR. |
0x001E | NavigationBar | None — open to PR. |
0x001F | TabRow | None — open to PR. |
0x0020 | AlertDialog | None — open to PR. |
0x0021 | ModalBottomSheet | None — open to PR. |
0x0022 | LazyVerticalGrid | LazyGridScope receiver lambda. |
0x0023 | HorizontalPager | PagerScope receiver lambda. |
Adding any of these is the standard recipe:
- Add a
composable=<fq>:0x00XXline toadapter-scan-roots.txt. - Run
./gradlew :ketoy-adapters-material3:kspRelease. - Done. The generated adapter handles the rest.
KBCParamSet typed getters
When an adapter is invoked, the runtime hands you a KBCParamSet
containing the decoded KBCValues for each slot. Use these typed
getters (all of them safely return defaults when the slot is encoded as
KBCValue.Default):
| Getter | Type |
|---|---|
getString(idx): String | String |
getStringOrNull(idx): String? | String? |
getInt(idx, default = 0): Int | Int |
getLong(idx, default = 0L): Long | Long |
getFloat(idx, default = 0f): Float | Float |
getDouble(idx, default = 0.0): Double | Double |
getBoolean(idx, default = false): Boolean | Boolean |
getChar(idx, default = ' '): Char | Char |
getColor(idx): Color | resolves KBCValue.ColorARGB, ColorUnspecified |
getDp(idx): Dp | resolves KBCValue.Dp(...), DpUnspecified |
getSp(idx): TextUnit | resolves KBCValue.Sp(...), TextUnitUnspecified |
getModifier(idx): Modifier | follows ModifierRef, applies dispatch lambda |
getFontWeight(idx): FontWeight? | from FontWeightInt |
getFontStyle(idx): FontStyle? | from FontStyleId |
getFontFamily(idx): FontFamily? | from FontFamilyTokenId or StringLiteral (via resolver) |
getTextAlign(idx): TextAlign? | from TextAlignId |
getTextOverflow(idx): TextOverflow | from TextOverflowId |
getTextDecoration(idx): TextDecoration? | from TextDecorationId |
getVerticalArrangement(idx): Arrangement.Vertical | |
getHorizontalArrangement(idx): Arrangement.Horizontal | |
getHorizontalAlignment(idx): Alignment.Horizontal | |
getVerticalAlignment(idx): Alignment.Vertical | |
getContentAlignment(idx): Alignment | |
getContentScale(idx): ContentScale | |
getKeyboardType(idx): KeyboardType | |
getImeAction(idx): ImeAction | |
getCapitalization(idx): KeyboardCapitalization | |
getImageVector(idx): ImageVector | via host resolver, falls back to PlaceholderImageVector |
getImageVectorOrNull(idx): ImageVector? | |
getPainter(idx): Painter | via host resolver, falls back to ColorPainter(Transparent) |
getPainterOrNull(idx): Painter? | |
getShape(idx): Shape | from Register carrying a RoundedCornerShape, etc. |
getLambda(idx): () -> Unit? | from FunctionRef / ClosureRef |
getValueChangeLambda<T>(idx): ((T) -> Unit)? | for onValueChange / onCheckedChange |
getContentSlot(idx): @Composable () -> Unit? | for content lambdas |
getItemContentSlot(idx): @Composable (Any?) -> Unit? | for LazyColumn/LazyRow item slots |
getPaddingValuesContentSlot(idx): @Composable (PaddingValues) -> Unit? | for Scaffold content |
getAnyOrNull(idx): Any? | escape hatch |
isDefaulted(idx): Boolean | true when the slot is KBCValue.Default |
Use isDefaulted(idx) to honour a paramDefault= directive at the
adapter level.
How adapter dispatch flows
KBC source → @KetoyComposable Foo() { Text(text="hi", color=Color.Red, ...) }
↓ compiler plugin
KBC bytecode → COMPOSABLE_CALL(0x0001, 2, [(0, StringLiteral(idx)), (2, ColorARGB(0xFFFF0000))])
↓ runtime
KBCInterpreter → Decodes opcode, builds KBCParamSet from non-defaulted params,
asks adapter registry for id=0x0001
↓
KBCComposableAdapter.invoke(params) → resolves slots via getters → calls real Text(...)Slots that aren't encoded resolve to their Compose source default (the
paramDefault= directive overrides this when set).
Next: Constructor Adapters →