---
title: Bootstrap Datepicker
product: Form Library
description: Bootstrap Datepicker | JS Survey and Form Library Example for JavaScript
framework: React
source: https://surveyjs.io/form-library/examples/custom-widget-bootstrapdatepicker/reactjs
index: https://surveyjs.io/form-library/examples/overview.md
---

# Bootstrap Datepicker (React)

## Files

### `public/index.html`

```html
<link rel="stylesheet" href="https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css">
<div id="surveyElement" style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; min-height: 100%; height:100%"></div>
```

### `src/SurveyComponent.jsx`

```js
import React from "react";
import { Model } from "survey-core";
import { Survey } from "survey-react-ui";
import "survey-core/survey-core.min.css";
import "./index.css";
import { json } from "./json";
import $ from "jquery";
import * as SurveyCore from "survey-core";
import { bootstrapdatepicker } from "surveyjs-widgets";
import "bootstrap-datepicker/dist/css/bootstrap-datepicker.css";


window["$"] = window["jQuery"] = $;
require("bootstrap-datepicker/dist/js/bootstrap-datepicker.js");
bootstrapdatepicker(SurveyCore);
function SurveyComponent() {
    const survey = new Model(json);
    survey.onComplete.add((sender, options) => {
        console.log(JSON.stringify(sender.data, null, 3));
    });
    return (<Survey model={survey} />);
}

export default SurveyComponent;
```

### `src/index.css`

```css
/* You can add your custom CSS here. */
```

### `src/index.js`

```js
import React from "react";
import { createRoot } from "react-dom/client";
import SurveyComponent from "./SurveyComponent";

const root = createRoot(document.getElementById("surveyElement"));
root.render(<SurveyComponent />);
```

### `src/json.js`

```js
export const json = {
  "elements": [
    {
      "name": "date",
      "type": "bootstrapdatepicker",
      "inputType": "date",
      "title": "Your favorite date:",
      "dateFormat": "mm/dd/yy",
      "isRequired": true
    }
  ]
};
```

### `src/theme.js`

```js
export const themeJson = {};
```

### `package.json`

```json
{
  "dependencies": {
    "react": "latest",
    "react-dom": "latest",
    "jquery": "latest",
    "bootstrap-datepicker": "1.9.0",
    "surveyjs-widgets": "latest",
    "survey-core": "latest",
    "survey-react-ui": "latest"
  },
  "devDependencies": {
    "react-scripts": "latest"
  }
}
```

## Other Frameworks

- [Angular](https://surveyjs.io/form-library/examples/custom-widget-bootstrapdatepicker/angular.md)
- [Vue 3](https://surveyjs.io/form-library/examples/custom-widget-bootstrapdatepicker/vue3js.md)
- [jQuery](https://surveyjs.io/form-library/examples/custom-widget-bootstrapdatepicker/jquery.md)
- [Vanilla JS](https://surveyjs.io/form-library/examples/custom-widget-bootstrapdatepicker/vanillajs.md)
