Last active
January 25, 2022 00:21
-
-
Save zach-klippenstein/47cf3662a664e1e434b3c943b8232e5c to your computer and use it in GitHub Desktop.
Sketch of a possible chip input implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Composable fun <C> ChipField( | |
chips: List<C>, | |
chipContent: @Composable (C) -> Unit. | |
modifier: Modifier = Modifier | |
) { | |
SelectionContainer( | |
allowCursor = true, | |
// some sort of callback or hoisted state for reading/mutating selection | |
modifier.textFieldFocusable() | |
) { | |
FlowRow { | |
chips.forEach { chip -> | |
key(chip) { | |
Box(Modifier.selectableNode(/* something */)) { | |
chipContent(chip) | |
} | |
} | |
} | |
// something for text field at the end, idk how that would look exactly | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment