# All files / helpers rem.js

100% Statements 0/0
100% Branches 0/0
100% Functions 0/0
100% Lines 0/0

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29

     // @flow

    import pixelsto from '../internalHelpers/_pxto'

    /**
     * Convert pixel value to rems. The default base value is 16px, but can be changed by passing a
     * second argument to the function.
     * @function
     * @param {string|number} pxval
     * @param {string|number} [base='16px']
     * @example
     * // Styles as object usage
     * const styles = {
     *   'height': rem('16px')
     * }
     *
     * // styled-components usage
     * const div = styled.div`
     *   height: ${rem('16px')}
     * `
     *
     * // CSS in JS Output
     *
     * element {
     *   'height': '1rem'
     * }
     */
    export default pixelsto('rem')