Skip to content
Fresnel is usable and under active development. There is no official release yet: get the sources from GitLab.

Fresnel

A modern widget set for native Free Pascal and Lazarus applications.

Fresnel is a set of visual controls (buttons, edits, lists, grids, menus, trees ...) for Object Pascal. Fresnel draws the controls itself, and CSS decides how they look and where they go. You get a normal, native program for Windows, Linux or macOS. The same code can also run in a web browser, compiled to WebAssembly.

The Fresnel control gallery, a native Linux program, with the Fresnel element inspector next to it
A native Linux program made with Fresnel, with its CSS inspector.

Fresnel in one picture

You write Pascal code, as you always did. The look and the layout go in CSS. The Free Pascal compiler turns it into a program.

Your Pascal code

  • forms and .lfm files
  • components with properties and events
  • your program logic, databases, files ...

CSS stylesheets

  • colors, fonts, borders
  • layout: flexbox, grid
  • light and dark theme

Free Pascal

  • the normal fpc compiler
  • in Lazarus, with lazbuild, or on the command line

A native program

  • Windows, Linux, macOS
  • Android new
  • no browser inside, nothing extra to install

A WebAssembly program optional

  • the same code, running in a web page
  • like the demos on this site

What Fresnel gives you

What does the code look like?

Pascal for what is on the form and what it does. CSS for how it looks.

type
  TForm1 = class(TFresnelForm)
    Body1: TBody;
    Label1: TLabel;
    Button1: TButton;
    procedure Button1Click(Event: TAbstractEvent);
  end;

procedure TForm1.Button1Click(Event: TAbstractEvent);
begin
  Label1.Caption:='Hello, Fresnel!';
end;
/* unit1.css: the stylesheet of the form */
body {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px;
}
button {
  background-color: #009692;
  color: white;
  border-radius: 6px;
  padding: 6px 14px;
}
button:hover { background-color: #007a77; }

Things Fresnel is not

We hear these ideas a lot. None of them are true.

Myth You need a browser to run a Fresnel program.
Fact

No. A Fresnel program is a normal native program. The browser is only one of the possible targets.

Myth You need pas2js to use Fresnel.
Fact

No. You compile Fresnel programs with the normal Free Pascal compiler. pas2js is only used for the small loader page of the browser version.

Myth You need the Skia graphics library.
Fact

No. On Linux, Fresnel draws with GTK3, and in the browser, the browser draws. Skia is used on Windows, macOS and Android, and it is shipped with Fresnel.

Myth You need a special "Fresnel IDE".
Fact

No. You use the normal Lazarus IDE, or any editor. The “IDE” demo is only an example program.

Myth You cannot mix Fresnel and the LCL.
Fact

You can. Fresnel forms and LCL forms can live in the same program, and Fresnel controls can sit on an LCL form.

Myth Fresnel is part of Lazarus.
Fact

No. Fresnel is a separate project, with its own repository. It is not installed with Lazarus, and it does not use the LCL.

Myth A Fresnel TButton has exactly the same properties as an LCL TButton.
Fact

No. Many names are the same, but positions, sizes, colors and fonts are set with CSS, not with properties.

Myth Fresnel is like HTML.
Fact

No. There is no HTML and no JavaScript. Fresnel borrows CSS and the idea of a tree of elements. Everything else is Pascal.

Real programs, real screenshots

All of these are native programs, except where the caption says otherwise.

A real application
A real applicationA time tracker, ported from the LCL to Fresnel. Its whole layout is a few dozen lines of CSS.
Light and dark mode
Light and dark modeThe same program, only the stylesheet is different. No change in the Pascal code.
A data grid
A data gridSorting, resizing, grouped headers, frozen rows and columns, and editing in the cells.
A code editor
A code editorSynEdit for Fresnel: syntax highlighting, code folding and code completion.
Design in Lazarus
Design in LazarusFresnel forms in the Lazarus form designer, with a CSS inspector like in a browser.
One program, three platforms
One program, three platformsThe same program on Windows, on Linux and in a web browser.

Where Fresnel runs

Fresnel chooses the right backend for the platform you compile for. Your code does not change.

WindowsWin32 windows, Skia drawing
LinuxGTK3 windows and drawing
macOSCocoa windows, Skia drawing
Androidnewest platform, Skia drawing
BrowserWebAssembly and HTML canvas
Inside the LCLon an LCL form, any LCL platform

See it for yourself

More than 60 demo programs run in your browser, with nothing to install. When you are ready, get the sources and build your first Fresnel program.