Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/polaris

Package Overview
Dependencies
Maintainers
24
Versions
2619
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/polaris

Shopify’s admin product component library

  • 13.9.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
24
Created

What is @shopify/polaris?

@shopify/polaris is a React component library designed to help developers create high-quality, consistent user interfaces for Shopify apps. It provides a wide range of pre-built components and styles that adhere to Shopify's design guidelines, making it easier to build applications that look and feel like native Shopify experiences.

What are @shopify/polaris's main functionalities?

Button

The Button component is used to trigger actions. It can be customized with different styles, sizes, and behaviors.

import { Button } from '@shopify/polaris';

function MyComponent() {
  return (
    <Button onClick={() => alert('Button clicked!')}>Click me</Button>
  );
}

Card

The Card component is used to group related content and actions. It provides a structured layout with a title and content area.

import { Card } from '@shopify/polaris';

function MyComponent() {
  return (
    <Card title="Card title" sectioned>
      <p>Card content goes here.</p>
    </Card>
  );
}

Form

The Form component is used to collect user input. It includes various input fields and a submit button, all wrapped in a form layout.

import { Form, FormLayout, TextField, Button } from '@shopify/polaris';

function MyComponent() {
  return (
    <Form onSubmit={() => alert('Form submitted!')}>
      <FormLayout>
        <TextField label="Name" onChange={() => {}} autoComplete="name" />
        <TextField type="email" label="Email" onChange={() => {}} autoComplete="email" />
        <Button submit>Submit</Button>
      </FormLayout>
    </Form>
  );
}

Page

The Page component is used to structure the main content of a page. It includes a title and a content area.

import { Page } from '@shopify/polaris';

function MyComponent() {
  return (
    <Page title="Page title">
      <p>Page content goes here.</p>
    </Page>
  );
}

Modal

The Modal component is used to display content in a layer above the main application. It can be used for dialogs, forms, or additional information.

import { Modal, Button } from '@shopify/polaris';
import { useState } from 'react';

function MyComponent() {
  const [active, setActive] = useState(false);

  return (
    <div>
      <Button onClick={() => setActive(true)}>Open Modal</Button>
      <Modal
        open={active}
        onClose={() => setActive(false)}
        title="Modal title"
        primaryAction={{
          content: 'Close',
          onAction: () => setActive(false),
        }}
      >
        <Modal.Section>
          <p>Modal content goes here.</p>
        </Modal.Section>
      </Modal>
    </div>
  );
}

Other packages similar to @shopify/polaris

Keywords

FAQs

Package last updated on 31 Oct 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc