Material Bread
v0.2.10
Home
Getting Started
React Native
Web
Electron
MacOS
Windows
NextJs
Expo
Vue Native
Style
Font
Icons
Theme
Components
Appbar
Searchbar
Appbar Bottom
Avatar
Backdrop
Badge
Banner
Bottom Navigation
Bottom Navigation Item
Button
Card
CardActions
CardContent
CardHeader
CardMedia
Checkbox
Chip
DataTable
DataTableCell
DataTableHeader
DataTablePagination
DataTableRow
Dialog
Divider
Drawer
DrawerHeader
DrawerItem
DrawerSection
DrawerBottom
Fab
Speed dial
Icon
IconButton
List
ListExpand
ListItem
ListSection
Menu
MenuItem
Paper
Progress Bar
Progress Circle
Radio Button
Ripple
Select
SheetBottom
SheetSide
Slider
Snackbar
SwipeNav
Switch
Tabs
Tab
Textfield
Searchfield
ToggleButton
ToggleButtonGroup
Tooltip
Typography
Utils
Anchor
Color
Hoverable
Shadow
Storybook
Showcase
Contributing
Library
Docs
About

Searchbar

Searchbar displays as a full appbar for searching

import { Searchbar } from 'material-bread';

Component #

The Searchbar component is a convenient component for displaying a full searchbar in an appbar. Usually this component is used on mobile.
Live Editing
class Demo extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      search: ''
    }
  }
  render() {
    return (
      <View>
        <Searchbar
          label={'Label'}
          value={this.state.search}
          onChangeText={value => this.setState({ search: value })}
          onCloseIcon={() => this.setState({ search: '' })}
        />
      </View>
    );
  }
}

Usage #

import React, { Component } from 'react';
import { View } from 'react-native';
import { Searchbar } from 'material-bread';

class Demo extends React.Component {
  constructor(props) {
    super(props)
    this.state = {
      search: ''
    }
  }
  render() {
    return (
      <View>
        <Searchbar
          label={'Label'}
          value={this.state.search}
          onChangeText={value => this.setState({ search: value })}
          onCloseIcon={() => this.setState({ search: '' })}
        />
      </View>
    );
  }
}

Props #

Name
Description
Type
Default
onChangeText
Callback when text is changed
func
onCloseIcon
Callback when close icon is pressed
func
onNavigation
Callback when navigation icon is Pressed
func
style
Styles root element
object
value
Search input
string
placeholder
Placeholder for input search
string
Search
navigationIcon
Navigation icon name
string
arrow-back
navigationIconComponent
One of the Icon components from react-native-vector-icons
function
closeIcon
Close icon name
string
close
closeIconComponent
One of the Icon components from react-native-vector-icons
function