Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div id="app"></div>
              
            
!

CSS

              
                
              
            
!

JS

              
                import faker from "https://cdn.skypack.dev/faker@5.5.3";
import { FixedSizeList as List } from "https://cdn.skypack.dev/react-window@1.8.6";

faker.seed(3)

const data = Array.from({ length: 50 }, () => ({
  avatar: faker.internet.avatar(),
  name: faker.name.findName(),
  username: faker.internet.userName(),
  email: faker.internet.email(),
}))

function ExpensiveItem({ avatar, name, username, email, ...props }) {
  return (
    <li className='py-4 flex' {...props}>
      <img className='h-10 w-10 rounded-full' src={avatar} alt='' />
      <div className='ml-3'>
        <p className='space-x-1'>
          <span
            className='text-base font-medium text-gray-900 whitespace-nowrap'
            style={{
              backgroundImage:
                'linear-gradient(transparent 50%, gold 50%, gold 85%,transparent 85%,transparent 100%)',
            }}>
            {name}
          </span>
          <span className='text-gray-600 text-xs'>@{username}</span>
        </p>
        <p className='text-sm text-gray-500'>{email}</p>
      </div>
    </li>
  )
}

function Skeleton({ ...props }) {
  return (
    <li className='py-4 flex' {...props}>
      <span className='h-10 w-10 rounded-full bg-gray-200 animate-pulse' />
      <div className='ml-3'>
        <p className='space-x-1'>
          <span className='inline-block h-3 w-24 bg-yellow-400 animate-pulse' />
          <span className='inline-block h-2 w-12 bg-gray-300 animate-pulse' />
        </p>
        <p className='inline-block h-2 w-44 bg-gray-200 animate-pulse' />
      </div>
    </li>
  )
}

function App() {
  return (
    <main className='grid place-items-center min-h-screen'>
      <List
        height={600}
        width={400}
        itemCount={data.length}
        itemSize={76}
        useIsScrolling={true}>
        {({ index, style, isScrolling }) =>
          isScrolling ? (
            <Skeleton style={style} />
          ) : (
            <ExpensiveItem
              style={style}
              avatar={data[index].avatar}
              name={data[index].name}
              username={data[index].username}
              email={data[index].email}
            />
          )
        }
      </List>
    </main>
  )
}

ReactDOM.render(
  <App />, 
  document.getElementById("app")
)
              
            
!
999px

Console