Type: React component

How to get Iframe?


import { Iframe } from 'fds/components';

Represents a nested browsing context, embedding another HTML page into the current page.


  1. applyCss


    Type: Object | Array<Object>

    A single object or an array of objects containing style rules to apply to the component.



    const styles = { maxHeight: '100px' };
    <Component applyCss={styles}>

    Note: Use this as a last resort to set certain styles that cannot be modified by other, more explicit props (eg. use <Flex flex="1" /> instead of <Flex applyCss={{ flex: '1' }} />). This helps the framework to reuse more and generate less runtime overhead which in turn helps with (re-)render performance across the board.

    Best practices when using applyCss:

    • Separating or grouping style rules.

    Try to group related style rules that often change together in a single object. Separate unrelated style rules into separate objects. Try to reuse grouped styles when sensible.

    • Static and dynamic styles.

    Try to define as much of your style rules at the module level. This means they are only processed once by the CSS-in-JS framework. Which gives the best performance.

    Styles at the module level are called 'static' styles because they don't (cannot) change during the program's runtime.

    You probably also have use cases for styling that depends on component props (and/or other dynamic data in general). These are called 'dynamic' styles because they might change during the program's runtime.

    Try to define dynamic styles statically (define your options at the module level): eg. if you have a component that displays either red or green text based on a prop (say, hasError), define two separate style objects at the module level and write a module level function which chooses between the style objects based on its parameters.

    If you can't, do not use applyCss: eg. if you have a component that has a height prop to set its height, you cannot define your options at the module level: height has an infinite number of values. Instead just set the style attribute of the element directly using a JSX expression: Eg. <div style={{height: this.props.height }} /> instead of <div {...applyCss({ height: this.props.height })} />.

    Default value

  2. onLoad


    Type: Function

    A callback that is called when the iframe is done loading.

    Default value

  3. onRef


    Type: Function

    A callback that is called whenever a component's ref changes.

    Use this callback to get a ref to (the domNode of) a component. There shouldn't be many usecases for using this prop yourself, but you might have to implement it with a given argument from a render callback somewhere.

    For more information about React and "refs", check the React documentation



    Default value

  4. src


    Type: String

    The url of the page to embed.