Pen Settings



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


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


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.


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.


                <section class="boilerform">
    <h2>Find a GitHub user</h2>
    <form class="form" method="post">
        <div class="form__row">
            <label for="name" class="c-label">Username</label>
            <input type="search" name="username" id="username" class="[ c-input-field ] [ js-name-field ]" value="" autocorrect="off" required />
        <div class="form__row">
            <button class="c-button" type="submit">Search</button>    
<div class="user" aria-live="assertive">
    <div class="user__avatar">
        <img class="js-avatar" src="" alt="A placeholder image" />
    <div class="user__info">
        <h2 class="js-name">Loading a user...</h2>
        <p class="js-bio"></p>
        <p><a href="#" class="js-profile-link">GitHub profile</a></p>


                :root {
    --bg: #f3f3f3;
    --radius: 4px;
    --border: #999;
    --links: #b71540

body {
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 
                    "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", 
                    "Fira Sans", "Droid Sans", "Helvetica Neue", 
    background: var(--bg);

.form__row + .form__row {
    padding-top: 1rem;

h2 {
    font-weight: 300;
    margin: 0 0 1rem 0;

.user {
    display: flex;
    align-items: flex-start;
    padding: 2rem 0 0 0;
    margin: 2rem 0 0 0;
    border-top: 1px solid var(--border);
    max-width: 500px;

.user__avatar {
    width: 70px;
    flex-shrink: 0;

.user__avatar img {
    border-radius: var(--radius);
    width: 100%;

.user__info {
    padding-left: 1rem;

a {
    color: var(--links);
    text-decoration-skip-ink: auto;

a:focus {
    text-decoration: none;


                // See the screencast here:

// Clear our console to remove any other logs from extensions etc

// We created this object in the screencast, but never actually used it 🙃
//const sharedState = {

// Load our DOM elements
const nameElement = document.querySelector('.js-name');
const bioElement = document.querySelector('.js-bio');
const profileLinkElement = document.querySelector('.js-profile-link');
const imageElement = document.querySelector('.js-avatar');
const formElement = document.querySelector('form');
const nameField = document.querySelector('.js-name-field');

// Load the data for our user from GitHub. We'll load my (hankchizljaw) profile by default
function loadUser(name = 'hankchizljaw') {
    fetch(`${ name }`)
        .then(response => {
            // Run the `json` method to extract the json payload from the GitHub response
            return response.json();
        .then(json => {
            // We've got json, so render the user
        // We catch any errors here 
        .catch(error => { console.error(error) });

// Take the passed data and assign to the relevant DOM elements
function renderUser(data) {
    nameElement.innerHTML =;
    bioElement.innerHTML =;
    profileLinkElement.setAttribute('href', data.html_url);
    imageElement.setAttribute('alt', `Image of ${ }`);
    imageElement.setAttribute('src', data.avatar_url);

// Catch the form's submit method 
formElement.addEventListener('submit', handleSubmit);

function handleSubmit(evt) {
    // Stop the form from posting back to the server
    // Load our user

// Load the default user to begin