Manuscript Library
fun ManuscriptLibrary(defaultDarkTheme: Boolean? = null, defaultComponentTheme: @Composable (darkTheme: Boolean, block: @Composable () -> Unit) -> Unit = { _, content -> content() }, block: @Composable ManuscriptLibraryScope.() -> Unit)
Composable to create a browsable library of components
Parameters
default Dark Theme
optional configuration to determine whether Manuscript should display components in light or dark mode by default
Overridden by the darkTheme
parameter of Manuscript, if defined
default Component Theme
optional configuration to allow each Manuscript component to be wrapped in your theme, including a parameter for whether Manuscript is displaying components in light or dark mode
Samples
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Scaffold
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import io.ezard.manuscript.theme.LocalManuscriptComponentName
import io.ezard.manuscript.theme.ManuscriptTheme
fun main() {
//sampleStart
ManuscriptLibrary {
Group(name = "Buttons") {
Component(name = "Rectangular Button") {
// Manuscript composable goes here
}
Component(name = "Circular Button") {
// Manuscript composable goes here}
}
Component(name = "Progress Indicator") {
// Manuscript composable goes here}
}
}
}
//sampleEnd
}