Skip to content

Instantly share code, notes, and snippets.

@daverau-optimizely
Last active July 9, 2019 22:51
Show Gist options
  • Select an option

  • Save daverau-optimizely/bca512b14095b4daae53fd4602b62fe6 to your computer and use it in GitHub Desktop.

Select an option

Save daverau-optimizely/bca512b14095b4daae53fd4602b62fe6 to your computer and use it in GitHub Desktop.

πŸ“˜ Get Started with OUI

🎨 Import CSS

Link to the latest oui.css only, no components included, always up-to-date:

<link rel="stylesheet" href="https://s3-us-west-2.amazonaws.com/design.optimizely.com/oui/latest/styles.css" />

πŸ”– For a list of helper classes available to use, see this Table of CSS properties in Storybook

πŸ“¦ React via Webpack

See the CodeSandbox Example

  1. Add OUI to your existing JavaScript project:
yarn add optimizely-oui
  1. Import OUI components in your app:
import React from 'react';
import { Button } from 'optimizely-oui';
...
return ( <Button size="tiny">Click Me</Button> );
  1. Include CSS:
<link rel="stylesheet" href="https://s3-us-west-2.amazonaws.com/design.optimizely.com/oui/latest/styles.css" />

🌈 React no Webpack

See the CodePen Example

<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
<script src="https://s3-us-west-2.amazonaws.com/design.optimizely.com/oui/latest/main.js"></script>

<div class="push-quad">
  <h1>Hello OUI React</h1>
  <div id="app"></div>
</div>

<script>
ReactDOM.render(
  <Button style='highlight'>I&apos;m a React Button</Button>,
  document.getElementById('app')
);
</script>

πŸ“ Layouts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment