Socket
Socket
Sign inDemoInstall

react-native-chips-ui

Package Overview
Dependencies
526
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-native-chips-ui

A react native chip library to create easy to use custoizable chips


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

installation

$ npm i react-native-chips-ui

or

$ yarn add react-native-chips-ui

Examples

Chip Component Example

variant types -> solid (default) , outlined , disabled
label -> "string"
import React from "react";
import { StyleSheet } from "react-native";
import { Chip } from "react-native-chips-ui";

function App() {
  // Function to handle press events on chips
  const onChipItemPress = () => {
    console.log("pressed");
  };

  return (
    <>
      {/* Chip component for user input */}
      <Chip
        label="What's On Your Mind? "
        style={styles.chip}
        onPress={onChipItemPress}
      />

      {/* Disabled Chip component for deletion */}
      <Chip
        variant="disabled"
        label="Delete"
        style={styles.chip}
        onPress={onChipItemPress}
      />
    </>
  );
}

const styles = StyleSheet.create({
  chip: {
    alignSelf: "flex-start",
  },
});

export default App;

Chips component example

itemVariant -> solid(default) , outline, disabled
import React, { useState } from "react";
import { StyleSheet } from "react-native";
import { Chips } from "react-native-chips-ui";

function App() {
  // State to manage the list of available items for the Chips component
  const [items, setItems] = useState([
    { label: "Football", value: "1" },
    { label: "Cricket", value: "2" },
    { label: "Tennis", value: "3" },
    { label: "Table Tennis", value: "4" },
    { label: "Basketball", value: "5" },
    { label: "Swimming", value: "6" },
  ]);

  // State to manage the selected values in the Chips component
  const [selectedValues, setSelectedValues] = useState(["1", "2"]);

  return (
    <>
      {/* Chips component for displaying and selecting items */}
      <Chips
        type="filter"
        itemVariant="outlined"
        items={items}
        setItems={setItems}
        selectedValues={selectedValues}
        setSelectedValues={setSelectedValues}
      />
    </>
  );
}

const styles = StyleSheet.create({
  // Additional styles can be defined here if needed
});

export default App;

Keywords

FAQs

Last updated on 18 Feb 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc