Plumeria logo/ ✾ Plumeria
Getting started

Define Styles

Get started with Plumeria using css.create() and css.props() to build styles with clarity and structure.

Rotation Card

Use css.create() to define reusable style objects:

import { css, ps } from '@plumeria/core';
 
const rotateHover = css.keyframes({
  from: {
    transform: 'rotate(0deg)',
  },
  to: {
    transform: 'rotate(360deg)',
  },
});
 
const rotateFocus = css.keyframes({
  from: {
    transform: 'rotateY(0deg) rotateX(0deg)',
  },
  to: {
    transform: 'rotateY(360deg) rotateX(90deg)',
  },
});
 
const styles = css.create({
  container: {
    display: 'flex',
    flexDirection: 'row',
    gap: 40,
  },
  card: {
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
    width: '200px',
    height: '200px',
    fontSize: '1.25rem',
    fontWeight: '600',
    backgroundColor: '#fefefe',
    borderRadius: '2rem',
    boxShadow: '0 8px 20px rgba(0,0,0,0.15)',
    transition: 'transform 0.4s ease, box-shadow 0.4s ease',
  },
});
 
const animated = css.create({
  hover: {
    [ps.hover]: {
      background: css.color.azure,
      boxShadow: '0 12px 30px rgba(0,0,0,0.25)',
      animationName: rotateHover,
      animationDuration: '1s',
      animationTimingFunction: 'linear',
      animationIterationCount: 'infinite',
    },
  },
  focus: {
    [ps.focus]: {
      outline: '2px solid dodgerblue',
      animationName: rotateFocus,
      animationDuration: '0.8s',
      animationIterationCount: 'infinite',
    },
  },
});
JSX
export const Box = () => {
  return (
    <div className={css.props(styles.container)}>
      <span>
        hover
        <span tabIndex={0} className={css.props(styles.card, animated.hover)} />
      </span>
      <span>
        focus
        <span tabIndex={0} className={css.props(styles.card, animated.focus)} />
      </span>
    </div>
  );
};

View

hoverfocus

FancyButtons

Use css.create() to define reusable style objects:

import { css, ps } from '@plumeria/core';
 
const styles = css.create({
  stack: {
    display: 'flex',
    gap: 16,
    alignItems: 'center',
    marginTop: 32,
  },
  button: {
    padding: '0.75rem 1.5rem',
    fontSize: '1rem',
    fontWeight: 600,
    color: '#fff',
    cursor: 'pointer',
    border: 'none',
    borderRadius: '0.75rem',
    boxShadow: '0 6px 16px rgba(79,70,229,0.3)',
    transition: 'all 0.3s ease',
  },
  hover: {
    [ps.hover]: {
      boxShadow: '0 8px 24px rgba(0,0,0,0.2)',
      transform: 'translateY(-2px)',
    },
  },
});
 
const buttons = css.create({
  focusPurple: {
    background: 'linear-gradient(135deg,rgb(68, 60, 222), #6366f1)',
    [ps.hover]: {
      background: 'linear-gradient(135deg, #3932c0, #6366f1)',
    },
    [ps.focus]: {
      outline: '2px solid #a5b4fc',
      outlineOffset: '4px',
    },
  },
  focusSky: {
    background: 'linear-gradient(135deg, #16adf9, #3ce1fb)',
    [ps.hover]: {
      background: 'linear-gradient(135deg, #0c9ce4, #3ce1fb)',
    },
    [ps.focus]: {
      outline: '2px solid #82c3e4',
      outlineOffset: '4px',
    },
  },
  focusGreen: {
    background: 'linear-gradient(135deg,rgb(10, 177, 121), #34d399)',
    [ps.hover]: {
      background: 'linear-gradient(135deg, #089e6c, #34d399)',
    },
    [ps.focus]: {
      outline: '2px solid #5bd3ab',
      outlineOffset: '4px',
    },
  },
})
JSX
export function FancyButtons() {
  return (
    <div className={css.props(styles.stack)}>
      <button className={css.props(styles.button, styles.hover, buttons.focusPurple)}>Purple</button>
      <button className={css.props(styles.button, styles.hover, buttons.focusSky)}>Sky</button>
      <button className={css.props(styles.button, styles.hover, buttons.focusGreen)}>Green</button>
    </div>
  );
}

View

On this page

;