Package-level declarations

Types

Link copied to clipboard
open class BooleanField(label: String, initialValue: Boolean) : MutablePreviewLabField<Boolean>

Field that holds a Boolean value. Switch allows you to switch values.

Link copied to clipboard
open class ByteField(label: String, initialValue: Byte, inputType: NumberField.InputType = InputType.TextField()) : NumberField<Byte>

Field that holds an Byte value.

Link copied to clipboard
class ColorField(label: String, initialValue: Color) : MutablePreviewLabField<Color>

A field for selecting colors using an interactive color picker.

Link copied to clipboard
open class CombinedField<Base, Value>(label: String, fields: List<MutablePreviewLabField<out Base>>, combine: (List<Base>) -> Value, split: (Value) -> List<Base>) : MutablePreviewLabField<Value>

A field that combines multiple sub-fields into a single composite value.

Link copied to clipboard
open class CombinedField1<A, Value>(label: String, field1: MutablePreviewLabField<A>, combine: (A) -> Value, split: (Value) -> Splited1<A>) : CombinedField<Any?, Value>
Link copied to clipboard
open class CombinedField10<A, B, C, D, E, F, G, H, I, J, Value>(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, field6: MutablePreviewLabField<F>, field7: MutablePreviewLabField<G>, field8: MutablePreviewLabField<H>, field9: MutablePreviewLabField<I>, field10: MutablePreviewLabField<J>, combine: (A, B, C, D, E, F, G, H, I, J) -> Value, split: (Value) -> Splited10<A, B, C, D, E, F, G, H, I, J>) : CombinedField<Any?, Value>
Link copied to clipboard
open class CombinedField2<A, B, Value>(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, combine: (A, B) -> Value, split: (Value) -> Splited2<A, B>) : CombinedField<Any?, Value>
Link copied to clipboard
open class CombinedField3<A, B, C, Value>(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, combine: (A, B, C) -> Value, split: (Value) -> Splited3<A, B, C>) : CombinedField<Any?, Value>
Link copied to clipboard
open class CombinedField4<A, B, C, D, Value>(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, combine: (A, B, C, D) -> Value, split: (Value) -> Splited4<A, B, C, D>) : CombinedField<Any?, Value>
Link copied to clipboard
open class CombinedField5<A, B, C, D, E, Value>(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, combine: (A, B, C, D, E) -> Value, split: (Value) -> Splited5<A, B, C, D, E>) : CombinedField<Any?, Value>
Link copied to clipboard
open class CombinedField6<A, B, C, D, E, F, Value>(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, field6: MutablePreviewLabField<F>, combine: (A, B, C, D, E, F) -> Value, split: (Value) -> Splited6<A, B, C, D, E, F>) : CombinedField<Any?, Value>
Link copied to clipboard
open class CombinedField7<A, B, C, D, E, F, G, Value>(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, field6: MutablePreviewLabField<F>, field7: MutablePreviewLabField<G>, combine: (A, B, C, D, E, F, G) -> Value, split: (Value) -> Splited7<A, B, C, D, E, F, G>) : CombinedField<Any?, Value>
Link copied to clipboard
open class CombinedField8<A, B, C, D, E, F, G, H, Value>(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, field6: MutablePreviewLabField<F>, field7: MutablePreviewLabField<G>, field8: MutablePreviewLabField<H>, combine: (A, B, C, D, E, F, G, H) -> Value, split: (Value) -> Splited8<A, B, C, D, E, F, G, H>) : CombinedField<Any?, Value>
Link copied to clipboard
open class CombinedField9<A, B, C, D, E, F, G, H, I, Value>(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, field6: MutablePreviewLabField<F>, field7: MutablePreviewLabField<G>, field8: MutablePreviewLabField<H>, field9: MutablePreviewLabField<I>, combine: (A, B, C, D, E, F, G, H, I) -> Value, split: (Value) -> Splited9<A, B, C, D, E, F, G, H, I>) : CombinedField<Any?, Value>
Link copied to clipboard
open class ComposableField(label: String, initialValue: ComposableFieldValue, val choices: List<ComposableFieldValue> = ComposableFieldValue.DefaultChoices) : ImmutablePreviewLabField<@Composable () -> Unit>

A field that allows selecting from predefined Composable content options.

Link copied to clipboard

Interface for values that can be used in a ComposableField. Provides a label and composable content.

Link copied to clipboard
open class DoubleField(label: String, initialValue: Double, inputType: NumberField.InputType = InputType.TextField()) : NumberField<Double>

Field that holds an Double value.

Link copied to clipboard
class DpField(label: String, initialValue: Dp) : TransformField<Float, Dp>

Field for editing Compose density-independent pixel (Dp) values

Link copied to clipboard

Field for editing Compose DpOffset values (x, y coordinates in Dp)

Link copied to clipboard
class DpSizeField(label: String, initialValue: DpSize) : MutablePreviewLabField<DpSize>

Field for editing Compose DpSize values (width, height in Dp)

Link copied to clipboard
class FixedField<Value>(label: String, value: Value, valueCodeProvider: () -> String? = null) : ImmutablePreviewLabField<Value>
Link copied to clipboard
open class FloatField(label: String, initialValue: Float, inputType: NumberField.InputType = InputType.TextField()) : NumberField<Float>

Field that holds an Float value.

Link copied to clipboard
open class IntField(label: String, initialValue: Int, inputType: NumberField.InputType = InputType.TextField()) : NumberField<Int>

Field that holds an Int value.

Link copied to clipboard
open class LongField(label: String, initialValue: Long, inputType: NumberField.InputType = InputType.TextField()) : NumberField<Long>

Field that holds an Long value.

Link copied to clipboard
class ModifierField(label: String, initialValue: ModifierFieldValueList = ModifierFieldValue.mark()) : ImmutablePreviewLabField<Modifier>

Interactive field for building and editing Compose Modifier chains

Link copied to clipboard
Link copied to clipboard

Create a PreviewLabField that makes the receiver's PreviewLabField nullable.

Link copied to clipboard
abstract class NumberField<Num : Number>(label: String, initialValue: Num, fromString: (String) -> Num, toString: (Num) -> String = { it.toString() }, inputType: NumberField.InputType = InputType.TextField(), valueCode: (Num) -> String) : MutablePreviewLabField<Num>

Abstract class of Field that handles numeric types.

Link copied to clipboard
class OffsetField(label: String, initialValue: Offset) : MutablePreviewLabField<Offset>

Field for editing Compose Offset values (x, y coordinates)

Link copied to clipboard
open class PolymorphicField<Value>(label: String, initialValue: Value, fields: List<PreviewLabField<out Value>>, valueToField: (Value) -> PreviewLabField<out Value> = sameType(fields), serializer: KSerializer<Value>? = null) : MutablePreviewLabField<Value>
Link copied to clipboard
class ScreenSize(val width: Dp, val height: Dp, val label: String = "x")

Represents a screen size with width and height in density-independent pixels

Link copied to clipboard
open class ScreenSizeField(label: String = "ScreenSize", sizes: List<ScreenSize> = listOf(MediumSmartPhone), type: SelectableField.Type = Type.DROPDOWN, initialValue: ScreenSize = sizes[0]) : SelectableField<ScreenSize>

A field for selecting screen sizes in the preview environment

Link copied to clipboard
open class SelectableField<Value>(label: String, val choices: List<Value>, choiceLabel: (Value) -> String = { it.toString() }, type: SelectableField.Type = DROPDOWN, initialValue: Value = choices[0], valueCode: (Value) -> String = { defaultValueCode(label) }, serializer: KSerializer<Value>? = null) : MutablePreviewLabField<Value>

A field that allows selection of one option from a list of specified choices.

Link copied to clipboard
class SizeField(label: String, initialValue: Size) : MutablePreviewLabField<Size>

Field for editing Compose Size values (width, height in pixels)

Link copied to clipboard
class SpField(label: String, initialValue: TextUnit) : TransformField<Float, TextUnit>

Field for editing Compose scalable pixel (Sp) values for typography

Link copied to clipboard
data class Splited1<A>(val first: A)

Data class that holds a single value split from a combined field.

Link copied to clipboard
data class Splited10<A, B, C, D, E, F, G, H, I, J>(val first: A, val second: B, val third: C, val fourth: D, val fifth: E, val sixth: F, val seventh: G, val eighth: H, val ninth: I, val tenth: J)

Data class that holds ten values split from a combined field.

Link copied to clipboard
data class Splited2<A, B>(val first: A, val second: B)

Data class that holds two values split from a combined field.

Link copied to clipboard
data class Splited3<A, B, C>(val first: A, val second: B, val third: C)

Data class that holds three values split from a combined field.

Link copied to clipboard
data class Splited4<A, B, C, D>(val first: A, val second: B, val third: C, val fourth: D)

Data class that holds four values split from a combined field.

Link copied to clipboard
data class Splited5<A, B, C, D, E>(val first: A, val second: B, val third: C, val fourth: D, val fifth: E)

Data class that holds five values split from a combined field.

Link copied to clipboard
data class Splited6<A, B, C, D, E, F>(val first: A, val second: B, val third: C, val fourth: D, val fifth: E, val sixth: F)

Data class that holds six values split from a combined field.

Link copied to clipboard
data class Splited7<A, B, C, D, E, F, G>(val first: A, val second: B, val third: C, val fourth: D, val fifth: E, val sixth: F, val seventh: G)

Data class that holds seven values split from a combined field.

Link copied to clipboard
data class Splited8<A, B, C, D, E, F, G, H>(val first: A, val second: B, val third: C, val fourth: D, val fifth: E, val sixth: F, val seventh: G, val eighth: H)

Data class that holds eight values split from a combined field.

Link copied to clipboard
data class Splited9<A, B, C, D, E, F, G, H, I>(val first: A, val second: B, val third: C, val fourth: D, val fifth: E, val sixth: F, val seventh: G, val eighth: H, val ninth: I)

Data class that holds nine values split from a combined field.

Link copied to clipboard
class StringField(label: String, initialValue: String, prefix: @Composable () -> Unit? = null, suffix: @Composable () -> Unit? = null) : MutablePreviewLabField<String>

A field that allows users to input a string value.

Link copied to clipboard
open class TransformField<BaseValue, TransformedValue>(baseField: MutablePreviewLabField<BaseValue>, transform: (BaseValue) -> TransformedValue, reverse: (TransformedValue) -> BaseValue, label: String = baseField.label, initialValue: TransformedValue = transform(baseField.value), valueCode: (TransformedValue) -> String = { defaultValueCode(label) }) : MutablePreviewLabField<TransformedValue>

Field that can have a separate field for holding values and a value for disclosing the status. Used for simple conversion processing when values are wrapped in value classes, etc.

Link copied to clipboard

A field wrapper that adds hint choices below the base field. Users can click on hint chips to quickly apply predefined values.

Link copied to clipboard
class WithSerializerField<Value>(baseField: MutablePreviewLabField<Value>, serializer: KSerializer<Value>) : MutablePreviewLabField<Value>

A wrapper field that customizes the serializer output of another field.

Link copied to clipboard
class WithTestValuesField<Value>(val baseField: PreviewLabField<Value>, additionalTestValues: Value) : PreviewLabField<Value>
Link copied to clipboard

A wrapper field that customizes the valueCode output of another field.

Link copied to clipboard

A field that wraps another me.tbsten.compose.preview.lab.MutablePreviewLabField with additional composable content.

Link copied to clipboard

Defines the scope of wrapping for a WrapField.

Functions

Link copied to clipboard
fun <A, Value> combined(label: String, field1: MutablePreviewLabField<A>, combine: (A) -> Value, split: (Value) -> Splited1<A>): CombinedField1<A, Value>

Creates a combined field from a single sub-field with transformation.

fun <A, B, Value> combined(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, combine: (A, B) -> Value, split: (Value) -> Splited2<A, B>): CombinedField2<A, B, Value>

Creates a combined field from two sub-fields.

fun <A, B, C, Value> combined(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, combine: (A, B, C) -> Value, split: (Value) -> Splited3<A, B, C>): CombinedField3<A, B, C, Value>

Creates a combined field from three sub-fields.

fun <A, B, C, D, Value> combined(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, combine: (A, B, C, D) -> Value, split: (Value) -> Splited4<A, B, C, D>): CombinedField4<A, B, C, D, Value>

Creates a combined field from four sub-fields.

fun <A, B, C, D, E, Value> combined(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, combine: (A, B, C, D, E) -> Value, split: (Value) -> Splited5<A, B, C, D, E>): CombinedField5<A, B, C, D, E, Value>

Creates a combined field from five sub-fields.

fun <A, B, C, D, E, F, Value> combined(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, field6: MutablePreviewLabField<F>, combine: (A, B, C, D, E, F) -> Value, split: (Value) -> Splited6<A, B, C, D, E, F>): CombinedField6<A, B, C, D, E, F, Value>

Creates a combined field from six sub-fields.

fun <A, B, C, D, E, F, G, Value> combined(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, field6: MutablePreviewLabField<F>, field7: MutablePreviewLabField<G>, combine: (A, B, C, D, E, F, G) -> Value, split: (Value) -> Splited7<A, B, C, D, E, F, G>): CombinedField7<A, B, C, D, E, F, G, Value>

Creates a combined field from seven sub-fields.

fun <A, B, C, D, E, F, G, H, Value> combined(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, field6: MutablePreviewLabField<F>, field7: MutablePreviewLabField<G>, field8: MutablePreviewLabField<H>, combine: (A, B, C, D, E, F, G, H) -> Value, split: (Value) -> Splited8<A, B, C, D, E, F, G, H>): CombinedField8<A, B, C, D, E, F, G, H, Value>

Creates a combined field from eight sub-fields.

fun <A, B, C, D, E, F, G, H, I, Value> combined(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, field6: MutablePreviewLabField<F>, field7: MutablePreviewLabField<G>, field8: MutablePreviewLabField<H>, field9: MutablePreviewLabField<I>, combine: (A, B, C, D, E, F, G, H, I) -> Value, split: (Value) -> Splited9<A, B, C, D, E, F, G, H, I>): CombinedField9<A, B, C, D, E, F, G, H, I, Value>

Creates a combined field from nine sub-fields.

fun <A, B, C, D, E, F, G, H, I, J, Value> combined(label: String, field1: MutablePreviewLabField<A>, field2: MutablePreviewLabField<B>, field3: MutablePreviewLabField<C>, field4: MutablePreviewLabField<D>, field5: MutablePreviewLabField<E>, field6: MutablePreviewLabField<F>, field7: MutablePreviewLabField<G>, field8: MutablePreviewLabField<H>, field9: MutablePreviewLabField<I>, field10: MutablePreviewLabField<J>, combine: (A, B, C, D, E, F, G, H, I, J) -> Value, split: (Value) -> Splited10<A, B, C, D, E, F, G, H, I, J>): CombinedField10<A, B, C, D, E, F, G, H, I, J, Value>

Creates a combined field from ten sub-fields.

Link copied to clipboard

Creates a ComposableFieldValue with custom content.

Link copied to clipboard
fun <Value> PreviewLabField<Value>.DefaultFieldView(modifier: Modifier = Modifier, menuItems: List<PreviewLabField.ViewMenuItem<Value>> = ViewMenuItem.defaults<Value>(this), content: @Composable () -> Unit = { Content() })

Default UI implementation of me.tbsten.compose.preview.lab.PreviewLabField.View. Display a label and draw the content below it.

Link copied to clipboard
inline fun <E : Enum<E>> EnumField(label: String, initialValue: E, type: SelectableField.Type = DROPDOWN, noinline choiceLabel: (E) -> String = { it.name }): SelectableField<E>

Create a SelectableField from enum class values.

Link copied to clipboard
fun <Value> PreviewLabField<Value>.FieldLabelHeader(menuItems: List<PreviewLabField.ViewMenuItem<Value>> = ViewMenuItem.defaults<Value>(this))

Display the label of PreviewLabField.

Link copied to clipboard
fun ModifierFieldValueList.mark(color: Color = Color.Red.copy(alpha = 0.5f), borderWidth: Dp = 2.dp): ModifierFieldValueList

Adds visual marking to a ModifierFieldValueList with border and background.

fun ModifierFieldValueList.mark(borderColor: Color = Color.Red.copy(alpha = 0.75f), backgroundColor: Color = borderColor.copy(alpha = borderColor.alpha * 0.5f), borderWidth: Dp = 2.dp): ModifierFieldValueList

Adds visual marking to a ModifierFieldValueList with customizable border and background colors.

Link copied to clipboard
fun <Value : Any> PreviewLabField<Value>.nullable(initialValue: Value? = this.initialValue): NullableField<Value>

Create a PreviewLabField that makes the receiver's PreviewLabField nullable.

Link copied to clipboard
Link copied to clipboard

Create a SelectableField with the given label and choices using a builder syntax.

fun <Value> SelectableField(label: String, choices: Map<String, Value>, type: SelectableField.Type = DROPDOWN, initialValue: Value = choices.entries.first().value): SelectableField<Value>

Create a SelectableField with the given label and choices from a map.

Link copied to clipboard
fun <A> splitedOf(first: A): Splited1<A>

Creates a Splited1 instance containing a single value.

fun <A, B> splitedOf(first: A, second: B): Splited2<A, B>

Creates a Splited2 instance containing two values.

fun <A, B, C> splitedOf(first: A, second: B, third: C): Splited3<A, B, C>

Creates a Splited3 instance containing three values.

fun <A, B, C, D> splitedOf(first: A, second: B, third: C, fourth: D): Splited4<A, B, C, D>

Creates a Splited4 instance containing four values.

fun <A, B, C, D, E> splitedOf(first: A, second: B, third: C, fourth: D, fifth: E): Splited5<A, B, C, D, E>

Creates a Splited5 instance containing five values.

fun <A, B, C, D, E, F> splitedOf(first: A, second: B, third: C, fourth: D, fifth: E, sixth: F): Splited6<A, B, C, D, E, F>

Creates a Splited6 instance containing six values.

fun <A, B, C, D, E, F, G> splitedOf(first: A, second: B, third: C, fourth: D, fifth: E, sixth: F, seventh: G): Splited7<A, B, C, D, E, F, G>

Creates a Splited7 instance containing seven values.

fun <A, B, C, D, E, F, G, H> splitedOf(first: A, second: B, third: C, fourth: D, fifth: E, sixth: F, seventh: G, eighth: H): Splited8<A, B, C, D, E, F, G, H>

Creates a Splited8 instance containing eight values.

fun <A, B, C, D, E, F, G, H, I> splitedOf(first: A, second: B, third: C, fourth: D, fifth: E, sixth: F, seventh: G, eighth: H, ninth: I): Splited9<A, B, C, D, E, F, G, H, I>

Creates a Splited9 instance containing nine values.

fun <A, B, C, D, E, F, G, H, I, J> splitedOf(first: A, second: B, third: C, fourth: D, fifth: E, sixth: F, seventh: G, eighth: H, ninth: I, tenth: J): Splited10<A, B, C, D, E, F, G, H, I, J>

Creates a Splited10 instance containing ten values.

Link copied to clipboard
fun <Value> PreviewParameterProvider<Value>.toField(label: String, choiceLabel: (Value) -> String = { it.toString() }, type: SelectableField.Type = DROPDOWN): SelectableField<Value>
fun <Value> List<Value>.toField(label: String, choiceLabel: (Value) -> String = { it.toString() }, type: SelectableField.Type = DROPDOWN, initialValue: Value = this[0]): SelectableField<Value>

Extension function to convert a List to a SelectableField.

Link copied to clipboard

Transforms a MutablePreviewLabField to work with a different value type.

Link copied to clipboard

Adds hint choices to a MutablePreviewLabField, allowing users to quickly select from predefined values.

Link copied to clipboard
fun MutablePreviewLabField<String>.withImageUrlHint(includeDummyImages: Boolean = true, includeInvalidImages: Boolean = true): MutablePreviewLabField<String>
Link copied to clipboard

Adds predefined color hints to a Color field for quick selection.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <Value> MutablePreviewLabField<Value>.wrap(wrapRange: WrapRange = WrapRange.OnlyContent, content: @Composable (@Composable () -> Unit) -> Unit): WrapField<Value>

Wraps this field with additional composable content.