geogebra-component.js

geogebra-component.js API reference

A web component to embed a GeoGebra applet.

It's a wrapper around deployggb.js provided by GeoGebra.

Usage

Construct a worksheet from scratch

Write GeoGebra commands inside the tag. These commands are evaluated immediately after the applet loads.


<geogebra-applet>
  A = (1,2)
</geogebra-applet>
            

Load a worksheet from GeoGebra.org by ID


<geogebra-applet material="sA5Mb4vd" />
<geogebra-applet material="https://www.geogebra.org/m/sA5Mb4vd" />
    

You can give just the ID, or you can give the full URL of a geogebra material, because that's easier to think about!

Attributes

The element supports attributes corresponding to most of the embedding parameters provided by the GeoGebra API:

There are also a few extra attributes corresponding to methods in the API, which change settings in the applet:

perspectiveDefine which views are visible, and in which order. A string of letters corresponding to views, as described in the documentation for SetPerspective
axesA comma-separated list of true or false values defining whether each axis is visible, in the order x,y,z.
xaxisIs the x axis visible?
yaxisIs the y axis visible?
zaxisIs the z axis visible?
pointcaptureThe point capturing mode: none, snap, fixed, or automatic.
roundingHow to round numbers. A number followed by either d for "decimal places", or s for "significant figures".
hidecursorwhendraggingHide the cursor when dragging objects?
repaintingactiveRepaint the applet when anything changes?
errordialogsactiveShould error dialogs be shown?
coordsystemA comma-separated list of coordinates for the viewport of the graphics window, in the order xmin,xmax,ymin,ymax.
axislabelsA comma-separated list of labels for the axes, in the order x,y,z.
xaxislabelThe label for the x axis.
yaxislabelThe label for the y axis.
zaxislabelThe label for the z axis.
axisstepsA comma-separated list of the distances between tick marks for each of the axes, in the order x,y,z.
axisunitsA comma-separated list of strings giving the units for each axis, in the order x,y,z.
gridShould the grid be visible?
editorstateInitial content for the algebra editor
rightAngleStyleThe style of right-angles. none, square, dot, or L.
gridIsBoldShould the grid be drawn a bit thicker?
gridTypeThe type of the grid.
gridDistanceThe distance between grid lines in each axis.
bgColorThe applet's background colour.
gridColorThe colour of grid lines.
axesColorThe colour of the axes.

Methods

The following methods from the GeoGebra API are also available on the <geogebra-applet> element:

Properties

The following properties on the <geogebra-applet> element object have defined setters or getters:

Modes

The GeoGebra API only refers to tool modes by number. This component maps readable names to these values. You can use these names with the <geogebra-applet> element's mode property.

NameValue
move0
point1
join2
parallel3
orthogonal4
intersect5
delete6
vector7
line bisector8
angular bisector9
circle two points10
circle three points11
conic five points12
tangents13
relation14
segment15
polygon16
text17
ray18
midpoint19
circle arc three points20
circle sector three points21
circumcircle arc three points22
circumcircle sector three points23
semicircle24
slider25
image26
show hide object27
show hide label28
mirror at point29
mirror at line30
translate by vector31
rotate by angle32
dilate from point33
circle point radius34
copy visual style35
angle36
vector from point37
distance38
move rotate39
translateview40
zoom in41
zoom out42
selection listener43
polar diameter44
segment fixed45
angle fixed46
locus47
macro48
area49
slope50
regular polygon51
show hide checkbox52
compasses53
mirror at circle54
ellipse three points55
hyperbola three points56
parabola57
fitline58
record to spreadsheet59
button action60
textfield action61
pen62
rigid polygon64
polyline65
probability calculator66
attach / detach67
function inspector68
intersect two surfaces69
vector polygon70
create list71
complex number72
point on object501
mode spreadsheet create list2001
mode spreadsheet create matrix2002
mode spreadsheet create listofpoints2003
mode spreadsheet create tabletext2004
mode spreadsheet create polyline2005
mode spreadsheet onevarstats2020
mode spreadsheet twovarstats2021
mode spreadsheet multivarstats2022
mode spreadsheet sort2030
mode spreadsheet sort az2031
mode spreadsheet sort za2032
mode spreadsheet sum2040
mode spreadsheet average2041
mode spreadsheet count2042
mode spreadsheet min2043
mode spreadsheet max2044
freehand mode73
view in front of502
plane three points510
plane point line511
orthogonal plane512
parallel plane513
perpendicular line (3d)514
sphere point radius520
sphere two points521
cone given by two points and radius522
cylinder given by two points and radius523
prism531
extrude to prism or cylinder532
pyramid533
extrude to pyramid or cone534
net535
cube536
tetrahedron537
rotate view540
circle point radius direction550
circle axis point551
volume560
rotate around line570
mirror at plane571