Soras-UI is a React Native package designed to help developers standardize the format of their user interfaces. By providing a comprehensive set of pre-designed components and styles, Soras-UI ensures consistency and efficiency in UI development. Whether you’re building a simple app or a complex application, Soras-UI offers a robust solution to maintain a cohesive design language across your project. With easy integration and customizable options, it simplifies the process of creating visually appealing and user-friendly interfaces.
This package can be downloaded by using the command
The Button component is a reusable UI element that provides a customizable button with various styling options. It supports different variants, sizes, and event handling, making it flexible for different use cases.
<Button
title="Testing"
onPress={/* your onpress action */}
/>
Props
Props
Description
title
Optional title for the button.
customStyleButton
Custom styles for the button, allowing for adjustments to the appearance.
customStyleTitle
Custom styles for the title text, allowing for adjustments like color, font size, etc.
vibrate
Boolean indicating whether to vibrate the device when an action is triggered.
vibrateDuration
Optional duration (in milliseconds) for the vibration, applicable if `vibrate` is set to `true`.
Calendar
The Calendar component provides an interactive date selection interface. It allows users to pick a date, navigate between months, and customize the appearance. It is designed to be lightweight, flexible, and easily integrated into different parts of an application.
<Calendar
width={300}
height={200}
dateRangeValue={/* get the date range */}
onPressDate={/* get the date */}
getDatesRange={/* true to get the date range, false to get date */}
/>
Props
Props
Description
width
Width for the calendar.
height
Height for the calendar.
getDatesRange
Boolean indicating whether the date range or just the data selected.
setMonthPosition
Optional starting position of the month in the calendar.
setYearPosition
Optional starting position of the year in the calendar.
dateRangeValue
A function that receives the `start` and `end` dates of the selected date range.
onPressDate
A function triggered when a specific date is pressed, passing the date as a string.
customTitleHeader
Custom ReactNode to replace the default title header of the calendar.
customSelectedDot
Custom ReactNode to replace the default dot displayed on selected dates.
customRangeDot
Custom ReactNode to replace the default dot displayed on date ranges.
customizeSelectedTextStyles
Custom text styles for the selected date.
customWeekTextStyles
Custom styles for the text of the week days.
customDateTextStyles
Custom styles for the text of the dates.
customStyles
An object to customize the appearance of the calendar, including the week type and whether to show last/next month’s dates.
weekType = Specifies the format of the week names: "short", "long", or "supaShort".
showLastNextDate = Boolean to determine if last and next month’s dates should be shown in the calendar.
Carousel
The Carousel component is a horizontally scrollable component that displays multiple items, one at a time or in a loop. It supports smooth animations, auto-scrolling, and gesture-based swiping. This component is useful for displaying images, product cards, testimonials, or any other content in a visually appealing manner.
<Carousel
data={/* carousel data */}
duration={/* duration in ms */}
overflow="hidden"
width={300}
activeDotColor={/* active dot color */}
inactiveDotColor={'grey'}
/>
Props
Props
Description
data
id = A unique identifier for each item in the `data` array.
title = Optional title for each item. If not provided, the item may not display a title.
image = The image URL or source to display for each item.
onPress = An function triggered when the item is pressed. If not provided
duration
Optional duration (in milliseconds) for animations or transitions.
overflow
Specifies how overflow content should be handled. Possible values are "hidden", "scroll", or "visible."
width
Optional width for the carousel.
height
Optional height for the carousel.
customStyleDot
Custom styles for the dot indicator, used in pagination or carousel components.
customStyleTitle
Custom styles for the title text.
activeDotColor
The color for the active dot indicator (e.g., in pagination).
inactiveDotColor
The color for the inactive dot indicator (e.g., in pagination).
Checkbox
The CheckBox component is a simple UI element that allows users to toggle between checked and unchecked states. It is commonly used in forms, settings, and multi-select lists. This component supports custom styling, labels, and controlled/uncontrolled states.
<CheckBox
title="/* your checkbox name */"
value={/* set your checkbox value here */}
onPress={/* get the check box value here */}
icon={( /* set customize icon here */)}
/>
Props
Props
Description
title
The title or label displayed next to the checkbox.
value
Boolean indicating whether the checkbox is selected (true) or not (false).
activeBoxStyles
Custom styles applied to the checkbox when it is active.
inactiveBoxStyles
Custom styles applied to the checkbox when it is inactive.
customBoxContainerStyles
Custom styles for the checkbox container.
icon
Custom icon to replace the default checkbox icon.
iconColor
The color of the default icon inside the checkbox.
vibrate
Boolean to enable or disable vibration feedback on checkbox press.
vibrateDuration
Duration (in milliseconds) of the vibration feedback when the checkbox is pressed.
Donut Chart
The DonutChart component is a circular chart that represents data as proportional slices of a donut. It is commonly used to visualize percentages, spending breakdowns, or progress indicators. This component supports custom colors, animations, labels, and dynamic data updates.
const data = [{ color: string, value: number, percentage: number}]
const font = useFont(require('./Roboto-Bold.ttf'), 20);
if (!font) return null;
return (
<DonutChart
gap={0.07}
radius={80}
strokeWidth={20}
outerStrokeWidth={30}
font={font}
data={data}
outerStrokColor={'black'}
totalValueSymbol="Rp" /* symbol that will apply infront the total value */
totalValueColor={'white'}
/>
)
Props
Props
Description
gap
The gap or spacing between each bar, specified as a number.
radius
The radius of the donut diagram.
strokeWidth
The width of the stroke for the circular component.
outerStrokeWidth
The width of the outer stroke of the circular component.
decimals
A `SharedValue` representing an array of numbers used for animations or dynamic updates.
totalValue
A `SharedValue` representing the total value of all segments.
font
The `SkFont` object used for rendering total value in middle of donut chart.
data
An array of objects where each object contains `color`, `percentage`, and `value` properties, defining the data for the chart or visualization.
displayTotalValue
Boolean to determine if the total value is displayed in middle od donut chart.
outerStrokColor
The color of the outer stroke of diagram.
totalValueSymbol
A string symbol displayed alongside the total value (e.g., currency symbol).
totalValueColor
The color of the text displaying the total value.
DropDown
a UI component that allows users to select an option from a list and calendar. When clicked or tapped, it expands to show multiple choices and collapses after a selection is made.
An array of objects containing { label, value } pairs for dropdown options.
onSelect
Callback function triggered when an option is selected.
mode
Defines the mode of the dropdown. Supports 'calendar' for date selection and 'picker' for a list selection.
height
Specifies the height of the dropdown button.
maxDropDownHeight
Limits the maximum height of the dropdown list.
vibrate
Enables vibration feedback when an option is selected.
vibrateDuration
Specifies the duration of the vibration in milliseconds.
textInputProps
Allows customization of the text input when applicable.
calendarProps
Allows customization of the calendar when in 'calendar' mode.
modalContainerStyle
Custom styling for the modal container.
pressableStyle
Custom styling for the dropdown button.
Dynamic Scrollview
The DynamicScrollView component is a flexible wrapper that allows content to be scrollable when it exceeds the screen height. It automatically adjusts based on the number of child components, preventing unnecessary scrolling when the content fits within the viewport. This component is ideal for dynamic layouts, long forms, or lists that might change in size.
<DynamicScrollView directionMode={{ direction: /* select the direction row/column */}}>
/* put your components here */
</DynamicScrollView>
Props
Props
Description
direction
Specifies the layout direction, either 'column', 'row', or undefined.
width
Defines the width of the component or its layout.
height
Defines the height of the component or its layout.
justifyContent
Defines how items are aligned along the primary axis. Acceptable values include 'flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'space-evenly', or undefined.
Expanded View
The ExpandedView component is a flexible container that automatically expands to fill the available space within a parent layout. It ensures that child components take up all the remaining space dynamically. This is useful when creating layouts where some elements should take up as much space as possible while keeping other components positioned correctly.
<ExpandableView
title={'Expand this component'}
renderItem={
<View>
<Typograph>{'Expanded'}</Typograph>
</View>}
/>
Props
Props
Description
title
A string that specifies the title that will displayed.
renderItem
A ReactNode that defines the content that will render inside the expanded component.
customHeader
An optional ReactNode that allows overriding the default header with a custom one.
customIcon
An optional ReactNode used to render a custom icon within the component, this component have include rotation animation.
customContainerStyle
An optional TextStyle object to customize the styling of the main container.
customHeaderStyle
An optional TextStyle object to customize the styling of the header.
customItemContainerStyle
An optional TextStyle object to customize the styling of expanded containers.
Modal
A customizable modal component that can be displayed at the bottom or center of the screen. It supports custom styling, a header, and a close button.
import { GestureHandlerRootView } from 'react-native-gesture-handler';
<GestureHandlerRootView style={{ flex: 1 }}>
// Your code
</GestureHandlerRootView>
<Modal
type="center"
isPopUp={// value of modal visibility}
onPressClose={// set close modal visibility}
title="Test"
>
// Your code
</Modal>
<Modal
type="bottom"
isPopUp={// value of modal visibility}
onPressClose={// set close modal visibility}
title="Test"
>
// Your code
</Modal>
Props
Props
Description
type
Determines the positioning of the modal. Can be 'bottom' for bottom placement or 'center' for center placement.
isPopUp
Controls the visibility of the modal. When true, the modal is shown; when false, it is hidden.
onPressClose
Callback function triggered when the close button is pressed. Receives a boolean argument.
title
Optional title displayed in the modal header.
customStyleModal
Optional custom styles applied to the modal.
customHeader
Allows customization of the modal header by passing a React component or element.
customModalContainer
Optional custom styles for the modal container.
customCloseIcon
Allows customization of the close button by passing a React component or element.
Radio Button
The RadioButton component is a UI element that allows users to select a single option from a group. It is commonly used in forms, surveys, and filter selections. This component supports custom styling, labels, and controlled selection states.
<RadioButton
data={/* put your array of data here */}
onPress={/* get your radio button response */}
selectedId={/* select unique id for the radio button */}
directionMode={{ direction: /* select the direction row/column } */}
icon={(/* set customize icon here) */}
/>
Props
Props
Description
data
An array of objects with id, title, and value properties.
onPress
Function triggered when an radio is pressed, receives data as an argument.
selectedId
The ID of the currently selected.
activeCircleStyles
Custom styles applied to the active circle.
inactiveCircleStyles
Custom styles applied to the inactive circle.
circleContainerStyles
Custom styles for the circle container.
iconColor
The color of the icon inside the circle.
width
The width of the component or its radio button.
directionMode
Object that defines layout direction and width. Includes 'direction' (row, column, or other string) and optional 'width'.
icon
Custom icon that to replace default icon.
vibrate
Boolean to enable or disable vibration on press.
vibrateDuration
The duration (in milliseconds) of the vibration when triggered.
Rating
The Rating component allows users to provide feedback using a star-based rating system. It supports customizable star icons, different rating scales, and both interactive and read-only modes. This component is commonly used in reviews, feedback forms, and user experience evaluations.
Input mode:
<Rating onChange={/* set data */} />
Display mode:
<Rating value={/* value */} disable={true} />
Props
Props
Description
length
Specifies the length of the stars
width
Specifies the width of each stars
height
Specifies the height of each stars
value
The value of the stars
onChange
Callback function triggered on stars value changed
starColor
Fill color of the stars icon
customIconActive
Custom icon displayed when active
customIconInactive
Custom icon displayed when inactive
justifyContent
Sets how children are aligned along the primary axis [center | flex-start | flex-end | space-between | space-around | space-evenly]
customContainerStyles
Custom styles for the main container component
disable
Disables input to the component
strokeColor
Color of stars stroke
SkeletonLoaders
The SkeletonLoaders component provides placeholder loading content, often used to represent content that is still loading, like text, images, or cards. It simulates the structure of the content, giving users a smooth visual experience while waiting for data to be fully loaded. Skeleton loaders are particularly useful in dynamic content loading scenarios to improve perceived performance and UX.
An optional number specifying the height of the component, if applicable.
customContainerStyle
An optional TextStyle object to customize the styling of the container.
customSkeletonStyle
An optional TextStyle object to customize the styling of the skeleton placeholder.
customCardStyle - [just for CardSkeletonLoader]
An optional TextStyle object to customize the styling of cards, applicable to card-based components.
duration
An optional number specifying the animation duration for loading effects, in milliseconds.
skeletonProps
An optional customization for the sekeleton inside.
animation
Specifies an animation effect for the dropdown. Supports 'wave' for a flowing animation and 'breathing' for a pulsing effect.
Snackbar
The Snackbar component provides brief feedback to users at the bottom of the screen, typically used to show messages, notifications, or alerts. It appears for a short duration and automatically disappears after a set period, providing non-intrusive notifications. It is ideal for success, error, or informational messages in your app.
const { trigger, setSnackBarType, setSnackBarTitle } = useTrigger();
return (
<Button
title={/* button title */}
onPress={() => {
setSnackBarType(/* set snackbar type) */;
setSnackBarTitle(/* set snackbar type) */;
trigger(); /* trigger the snackbar */
}}
/>
)
Put this in your App():
<TriggerProvider>
/* your code */
<SnackBar delay={5000} animatedHeight={80} />
</TriggerProvider
Props
Props
Description
delay
Optional delay show time (in milliseconds).
animatedHeight
Optional height for the animated transition, allowing dynamic resizing.
undoButton
Boolean indicating whether an undo button should be displayed.
onUndo
A callback function triggered when the undo button is pressed.
onClose
A callback function triggered when the close action is initiated.
Switch
The Switch component is a toggle button that allows users to switch between two states (e.g., "ON" and "OFF"). It is commonly used for settings, enabling or disabling options, or controlling features in an app. The component is interactive, and you can style it to suit your app's design. It also supports custom labels, sizes, and colors.
<Switch
value={/* boolean value of switch */}
onPress={/* get value at here */}
/>
Props
Props
Description
value
A boolean indicating the current state or value of the toggle or control.
onPress
A function triggered when the component is pressed or toggled.
disabled
An optional boolean that disables interaction with the component when true.
customTrackStyles
An optional TextStyle object to customize the appearance of the track or background of the switch.
customThumbStyles
An optional TextStyle object to customize the appearance of the thumb or indicator of the switch.
icon
An optional ReactNode to render a custom icon inside thumb.
vibrate
An optional boolean to enable vibration feedback when the component is interacted with.
vibrateDuration
An optional number specifying the vibration duration in milliseconds when vibration is enabled.
TextInputFiled
The TextInputField component provides a user-friendly input field where users can enter text. It can be used for forms, search bars, login screens, or any other feature that requires text input. This component is highly customizable, supporting placeholders, labels, secure input, and validation feedback. It also offers a flexible style to fit different UI designs.
<TextInputField
title="/* your text input title */"
onTextChange={/* get value at here */}
placeHolder="/* your text input place holder */"
value={/* input value here */}
/>
Props
Props
Description
title
The title displayed alongside the text input.
value
The current value of the text input.
onTextChange
A function called when the input changes, passing the new text as an argument.
placeHolder
Optional placeholder text to display when the text input is empty.
height
Optional height for the text input.
align
Optional alignment for the text input content, can be "right", "left", or "center".
RenderItemRight
Optional content that will render inside the text input filed component.
customTextinputStyles
Custom styles for the text input component, allowing for customization of its appearance.
customContainerStyles
Custom styles for the container of the text input, allowing adjustments to layout and positioning.
customTitleSyle
Custom styles for the title, allowing for adjustments like font, color, and size.
editable
Boolean indicating whether the text input is editable. Defaults to `true`.
secureTextEntry
Boolean that determines whether the text input should be masked for secure input, like a password field.
TextInputSingleBox
The TextInputSingleBox component is a unique input field designed to capture one character per box, making it ideal for scenarios like entering a PIN code, OTP (One-Time Password), or other multi-character inputs. Each character is entered in a separate box, and the user can navigate between the boxes easily. This component provides an enhanced user experience by keeping the input clear and segmented, making it easy for users to input multiple characters.
A callback function that is triggered when the input changes, passing the updated code.
type
Defines the type of output that will passed, either "string" or "array".
length
The expected length of the input.
width
Optional width for each input container.
height
Optional height for each input container.
customTextinputStyles
Custom styles for the text, allowing for adjustments to appearance.
customContainerStyles
Custom styles for the container surrounding the text input.
Theme Management
The ThemeSwitch component is a tool designed to manage and track theme changes in your application. It allows users to toggle between light and dark themes (or other custom themes) and records the changes, including the active theme colors. This component is useful for implementing theme management in your app, providing a seamless user experience by allowing users to choose their preferred theme while preserving the theme state across app sessions.
Put this in your App():
import {useTheme} from 'soras-ui'; /* import the package */
return(
<ThemeProvider>
/* your code */
</ThemeProvider>
)
conts yourApp = () => {
const { theme, toggleTheme, toggleSystemTheme } = useTheme();
return (
<Switch
value={/* value of the switch */}
onPress={/* get value here */}
disabled={/* set if the switch disable */}
/>
)
}
Props
Props
Description
theme
Current theme of the app, which can be 'light' or 'dark'.
customColors
An object containing user-defined colors for customizing the theme.
toggleTheme
Function to switch between light and dark themes manually.
toggleSystemTheme
Function to enable or disable system-based theming.
Vibration Management
A component that manages vibration settings, allowing users to enable/disable vibration and adjust its duration.